maven: multi-module project assembly into single jar

Jeroen picture Jeroen · Apr 23, 2010 · Viewed 14k times · Source

I have a multi-module project and want to create a single jar containing the classes of all my modules. Inside my parent POM, I declared the following plugin:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-assembly-plugin</artifactId>
 <configuration>
  <descriptorRefs>
   <descriptorRef>bin</descriptorRef>
  </descriptorRefs>
 </configuration>
</plugin>

However, when running mvn assembly:assembly, only the source from the parent folder (empty) are included. How do I include the sources from my modules into the archive?

Answer

Lincoln picture Lincoln · May 12, 2010

I think you are looking for the Maven Shade Plugin:

http://maven.apache.org/plugins/maven-shade-plugin/index.html

Packages up any number of dependencies into an uber package depenency. This can then be deployed to a repository.