no main manifest attribute in maven jar

Maven have a pretty awesome tutorial in their getting started guide here:

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.


Author: jamandbees

There's just this whole, like, wha? Out there in the world, y'know? The jam and the bees, please.

5 thoughts on “no main manifest attribute in maven jar”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: