I’ve multi module project and using maven’s assembly plugin to zip the project’s artifact.
Proj
+Module A
pom.xml
+Module B
pom.xml
pom.xml
When i build main module, it will produce following things
Proj
+Module A
target\A.jar
target\A-source.jar
target\A-javadoc.jar
+Module B
target\B.jar
target\B-source.jar
target\B-javadoc.jar
1) I’ve added assembly plugin under ModuleB pom file and I’m using ModuleSet in assembly discriptor file
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>groupA:A:jar</include>
<include>groupA:A:javadoc</include>
<include>groupA:A:source</include>
</includes>
<binaries>
<outputDirectory>moduleA</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>groupB:B:jar</include>
<include>groupB:B:javadoc</include>
<include>groupB:B:source</include>
</includes>
<binaries>
<outputDirectory>moduleB</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
But i’m getting only A.jar and B.Jar under zip file. I’m not getting javadoc and source in zip file. Is it downloading it from m2 repo, i’m suspecting if it does so, because sources and java doc wouldn’t be there in maven reporee artifact. How can i add all three artifact in a zip file ?
2) I want to add assembly plugin in my parent pom rather than in ModuleB’s pom but if i do so, i get an exception “Please ensure the package phase is run before the assembly is generated”. After googling, i found few suggetion to add assembly as module. Is there any other way to handle this ?
I used dependecySet to solve this problem, we can use wildcard to add all binaries.
This will add all binary artifacts of project. One more thing to note is the id used in assembly descriptor. It should be bin for binary artifact.
Posting here in case if anybody runs into similar kind of issue, this might help.