I'm using Maven to build a project I'm working on. The build works fine, the problem happens when I run the generated JAR. The error says the main class com.apress.springrecipes.sequence.Main cannot be found.
But looking at the folder structure I'm not seeing why the Main class can't be found.
Here's the folder structure:
myJar.jar
--com
--apress
--springrecipes
--sequence
--Main.class
--META-INF
--MAINIFEST.MF
The MANIFEST.MF file has the main class attribute set to com.apress.springrecipes.sequence.Main
. But it looks like the JAR can't find it even though the class file is located in the JAR.
Here's the relevant portion of my pom.xml that handles the build:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>C:/Users/Graham/.m2/repository/</classpathPrefix>
<classpathLayoutType>repository</classpathLayoutType>
<mainClass>com.apress.springrecipes.sequence.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Why isn't the Main class being found in the jar even though it's there?