Apache Maven Maven Assembly Plugin Creating .jar file with all the dependencies of the project


To create a JAR containing all of its dependencies, it is possible to use the built-in descriptor format jar-with-dependencies. The following example configures an execution of the Assembly Plugin bound to the package phase, using this built-in descriptor and declaring a main class of com.example:



mvn clean package

on the command-line will result in the jar-with-dependencies to be built and attached to the project.

If more control over this uber-jar is needed, turn to the Maven Shade Plugin.