I have a multi-module maven 2 project which uses assemblies (via maven-assembly-plugin at the package phase) to package each module in a certain way. I am then trying to use another module to combine these assemblies into a distributable “installer” package. For the installer module I can see the default jar from my other projects but nothing I do seems to give me access to the extra assemblies. It seems from the documentation that this should be possible so I assume I’m either doing something wrong or it’s a bug in Maven? I’ve been stuck with this for several days now so any help would be appreciated!
Following on from a comment I have created a test project on github to demonstrate the this, the proj1 module creates 2 jar files. I would expect the assembly generated in the “package” module to include them both but it doesn’t it just includes the main project jar.
https://github.com/unluckypixie/maven-packaging-test
Please note: I know the content of the jars for proj1 one are the same in this example – but they are not in my real life situation, I don’t think what is in the proj1 files is relevant to the problem.
if you run:
mvn clean package
And do ls proj1/target/*.jar you should see:
proj1/target/proj1-1.0-SNAPSHOT.jar
proj1/target/proj1-1.0-SNAPSHOT-proj1-assembly.jar
If you look in the package jar :
jar -tvf package/target/package-1.0-SNAPSHOT-package-assembly.jar
You will see something like:
0 Mon Jul 30 16:27:00 BST 2012 META-INF/
106 Mon Jul 30 16:26:58 BST 2012 META-INF/MANIFEST.MF
0 Mon Jul 30 16:21:46 BST 2012 package/
2358 Mon Jul 30 16:21:44 BST 2012 package/proj1-1.0-SNAPSHOT.jar
2363 Mon Jul 30 16:21:46 BST 2012 package/package-1.0-SNAPSHOT.jar
I want to know how why the proj1/target/proj1-1.0-SNAPSHOT-proj1-assembly.jar is not in there too.
The packaging assembly looks like this:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>package-assembly</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>org.test.parent:*</include>
</includes>
<binaries>
<outputDirectory>/package/</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
I have managed to get this working by using the attachmentClassifier in my assembly file, e.g:
Thanks to khmarbaise for your help, I might not have used your solution but it helped me get there!