Maven and the Main-Class

I was not sure where to specify the Main-Class to get Maven to pick it up. Searched a bit and there was this recommendation on the Apache site about creating a src/main/resources/META-INF directory and it talked about the MANIFEST.MF. I must have read things wrong because I was never able to get that to work.

I found this other reference to add it to the pom.xml as a build section under the dependencies. That worked like a charm within seconds.

So here is my pom.xml with the Main-Class addition:

 <project xmlns="" xmlns:xsi=""







I initially forgot to specify the version for the maven-jar-plugin and maven gave me a detailed message to get it fixed:

[WARNING] Some problems were encountered while building the effective model for com.cinq.test:mvntest:jar:0.1.0
[WARNING] ‘build.plugins.plugin.version’ for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 28, column 15
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

Published by


Java developper that loves photography and an excellent espresso

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s