Apologies if this is covered elsewhere, I’m afraid I couldn’t find an answer to this particular trivial question.
I have a maven project which references and builds 4 sub projects (as bundles). I have set the dependencies between the sub-projects correctly and ultimately I get 4 different .jar files build built:
- parentproj/sub1/target/sub1.jar
- parentproj/sub2/target/sub2.jar
- parentproj/sub3/target/sub3.jar
- parentproj/sub4/target/sub4.jar
My question is, how do I set-up mu parent build so that when I build from the main .POM file, all 4 jars are placed in “/parentproj/target/…”?
An additional question is, how do I also build a xxxx-ALL.jar (that merges the contents of these 4 bundles)?
Just use the Maven Assembly plugin with the “dir” format to put them all in a folder, and the “jar” format to group them into a jar.
Some more details:
pom.xml file:
assembly.xml file: