I am trying to run a jar created by the maven shade plugin. I am configuring the main class the following way:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>org.comany.MainClass</Main-Class>
<Build-Number>123</Build-Number>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
...
But when I try running the jar using java -jar app.jar it gives the following error
"no main manifest attribute, in app.jar"
EDIT: I checked the contents of the jar using jar tf app.jar and I see a MANIFEST.MF file. BUt it does not have the entry for main class. How do I make sure the manifest file in jar has this entry apart for adding it in the shade plugin configuration?
Check if you have more than one main(). If you do, maven needs to know which one to use.