Have Maven build a jar with all dependencies included (Misc)

Maven is a software/dependency management tool for Java - it can be used to pull in dependencies and build a jar from a bunch of source

By default, the jar won't have dependencies rolled into it. Sometimes though, you want the overhead of the bigger jar.

Details

  • Language: Misc

Snippet

mvn assembly:assembly -DdescriptorId=jar-with-dependencies

Usage Example

mvn assembly:assembly -DdescriptorId=jar-with-dependencies
java -cp target/exampletest-1.0-SNAPSHOT-jar-with-dependencies.jar com.example.exampleorg.ExampleTestApp