How to create runnable JAR file with Maven

How to create runnable JAR file using Maven assembly plugin.

By default if you run goal package, a JAR file will be created. But without dependencies and inside META-INF/MANIFEST.MF won't be specified Main-Class.


How to create a runnable Java application? Using Maven assembly plugin.

Add inside pom.xml file:


and then run goal:

 clean package assembly:single 

and inside target directory will be created a JAR file with packaged dependencies

comments powered by Disqus


Free online Java web application examples

Want to develop whole web applications which use database, security and more? See my github account, where are lot's of example projects: