I just started learning how to use m2eclipse. What I'm trying to do is make a very simple program (Hello, World) and turn it into an executable jar. The java code itself:
public class Speak {
public static void main(String[] args) {
System.out.println("Meow!");
}
}
which works great as a Java application. Then I try to use Maven to create the program, which is what happens, but then when I try to run .jar, it says to me: “Could not load Main-Class attribute from ...”. This is the .pom that m2eclipse generates when the project starts:
<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>org.felines</groupId>
<artifactId>tabbies</artifactId>
<version>0.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<type>maven-plugin</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
I tried modifying .pom, for example:
<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>org.felines</groupId>
<artifactId>tabbies</artifactId>
<version>0.0</version>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<mainClass>org.felines.Speak</mainClass>
<packageName>org.felines</packageName>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${pom.url}</url>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Now he says: "Could not find the main class: org.felines.Speak. The program will exit." Any ideas?: (
Thank you for your time!