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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>com.cinq.test</groupId>
<artifactId>project1</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<name>project1</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<mainClass>com.cinq.test.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
References:
http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
Note:
I initially forgot to specify the version for the maven-jar-plugin and maven gave me a detailed message to get it fixed:
[WARNING]
[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]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]