0

I want to build one jar that includes a child module which depends on other package of my own project.

The output one jar should include all the related class (both from jar and my own project's classes).So the child module's classes is the base classes that should be included in the output jar,and these import some classes of my own project.All the related classes in my own project should be included.

for more detail please visit How to automatically collect all related class into one jar (use maven)?

Here is what I already find:

  <project>
   <dependencies>
    <dependency>
        <scope>system</scope>
        <systemPath>D:\how\to\write</systemPath>
        <groupId>how.to.write</groupId>
        <artifactId>how-to-write</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>java-source</type>
     </dependency>
   </dependencies>
 </project>

The error message is : Could not find artifact how.to.write:how-to-write:jar:sources:0.0.1-SNAPSHOT at specified path D:\how\to\write

the path D:\how\to\write contains my own project's classes that could support the build

Community
  • 1
  • 1
DunkOnly
  • 1,682
  • 4
  • 17
  • 39

1 Answers1

0

Your maven dependency will look for a jar file with name how.to.write:how-to-write:jar:sources:0.0.1-SNAPSHOT in D:\how\to\write directory. Since you do not have one, the build will fail.

If your own project does not use maven, then you should create a jar file and place it in D:\how\to\write location and rename it to how.to.write:how-to-write:jar:sources:0.0.1-SNAPSHOT. Then your build mvn clean install will be success.

The command for creating jar file is jar cf jar-file input-file(s). Have a look at this page on how to create a jar file

Omkar Puttagunta
  • 4,036
  • 3
  • 22
  • 35
  • Thank you. But in fact I could build it successfully in this way system .jar jar Do you know how to let the local system jar be included into the output jar? – DunkOnly Dec 04 '15 at 06:40
  • OK. Try ading this plugin to your `pom.xml`. ` maven-assembly-plugin 2.6 jar-with-dependencies ` and build the project – Omkar Puttagunta Dec 04 '15 at 06:48
  • you know, if I don't add . it will not build any thing.But if I add.,the output jar only contains the 's path's classes and the dependencies of maven repo without my jar of local system path – DunkOnly Dec 04 '15 at 07:02