Create a self-contained .jar file with Maven

If you want to create a self-contained .jar file, with all library dependencies included, you can do it with Maven. Include this in your pom.xml:


Then when you run mvn package, you will get a target/*-jar-with-dependencies.jar file which you can run with java -jar.

This entry was posted in Java. Bookmark the permalink.