我使用maven,我有pom.xml:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.main.Test</mainClass>
</configuration>
</plugin>
当我在命令行中使用时:
mvn exec:java -Dexec.mainClass=test.main.Test
我有一个错误:
[WARNING]
java.lang.ClassNotFoundException: test.main.Test
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:680)
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project TestApp: An exception occured while executing the Java class. test.main.Test -> [Help 1]
有什么问题?我不知道出了什么问题......