Maven have a pretty awesome tutorial in their getting started guide here: http://maven.apache.org/guides/getting-started/index.html
The problem is that if you follow it letter for letter, then run:
java -jar target/<jarname.jar>
you receive a “no main manifest attribute” error.
Stackoverflow has a good answer for this problem, but it took a few readings before I understood what they were saying. Here’s a link to the stackoverflow question:
Open your pom.xml and add the section listed:
This goes after the URL tag, but before the dependencies tag.
After this, run the following maven command:
mvn clean compile assembly:single
This will output a jar-with-dependencies.jar file in your target\ directory.
5 thoughts on “no main manifest attribute in maven jar”
Thanks. Your post helped me
HOURS of searching before I found your solution. Thanks! It’s probably saved me yet more hours!
You save my day!!!!!!!!!!!!!!!! Thank you so much!!!!!!!!!!!!!!!!
Thanks for this article, saved me time