I am trying to build a project in Java that should run if executed with double click. That's not been working so I debugged with cmd and there was no main class entry in the manifest.
So i added the contents of this answer (adopted to my application): Missing Main-Class attibute in MANIFEST.MF in Maven generated jar file
I am using jenkins as build platform and have tried executing with mvn clean install and mvn clean package.
pom.xml:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.progii</groupId>
<artifactId>pong</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>pong</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>de.progii.pong.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I partly fixed the problem. The problem is not the maven jar plugin, its jenkins. It simply archives the wrong build. The artifact available for download seems to be archived before the maven jar plugin does the job. If I connect with sftp to the workingspace/target folder I can download the artifact with the same name as the artifact at the jenkins download page but execute it successfully!
With the latest Update to Jenkins its working correctly