i try to using Eclipse Maven to build jar with dependencies
but when i execute
java -jar App.jar
got the error : "no main method found"
My pom.xml looks like this:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.maventest
aproject
0.0.1-SNAPSHOT
jar
aproject
http://maven.apache.org
UTF-8
junit
junit
3.8.1
test
it's just a simple java code:
package com.maventest.aproject;
public class App {
public static void main( String[] args ) {
System.out.println( "Hello World!" );
}
}
eclipse version: 4.5.2
Can anyone help me with this?
Thanks.
解决方案
You can use maven-jar-plugin for that purpose.
org.apache.maven.plugins
maven-jar-plugin
${maven-jar-plugin.version}
twaren.elk.elkMaven.App