I have a class ClassA in package packageA and ClassA import ClassB in packageB.(in fact ClassA import a lot of java file)
Then the directory is :
root
pom.xml
src
packageA
classA
pom.xml
packageB
classB
My goal is to generate a jar include classA and classB by only telling maven that I input classA.
the pom.xml in the packageA directory is like
<dependencies>
<dependency>
<scope>system</scope>
<systemPath>D:\path\to\my\local.jar</systemPath>
<groupId>com.abc</groupId>
<artifactId>abc</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<!--other dependency in maven repo-->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<sourceDirectory>.</sourceDirectory> <!--if I don't add this line ,the output jar will not include anything of my own project-->
</build>
You know, if I don't add <sourceDirectory>.</sourceDirectory>
it will not build any thing.But if I add<sourceDirectory>.</sourceDirectory>
,the output jar only contains the <sourceDirectory>
's path's classes and the dependencies of maven repo , without my jar of local system path
(In fact the local jar of my own is to support the <sourceDirectory>
's path's classes' build .Also in fact the local jar contains the classB)
Why my own jar's related classes have not been added in the output jar?