我想執行位於與包含main方法的pom.xml相同的文件夾中的類文件(或jar文件)。如何配置exec-maven-plugin類路徑
這裏是我的pom.xml
http://maven.apache.org/maven-v4_0_0.xsd「> 4.0.0 圖奧馬斯 睡眠 POM 1.0快照
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>sleep</id>
<phase>verify</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>tuomas.App</mainClass>
<classpathScope>tuomas</classpathScope>
</configuration>
</plugin>
</plugins>
</build>
而且我得到以下錯誤:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java (sleep) on project sleep: Execution sleep of goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java failed: Invalid classpath scope: tuomas -> [Help 1]
這是我的文件夾結構
pom.xml 。 ..tuomas.App.class
我也試過不在插件配置中指定classpathScope屬性,而是得到了下面的錯誤。
[WARNING]
java.lang.ClassNotFoundException: tuomas.App
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:745)
無論類文件是在tuomas文件夾下還是在項目根目錄下。也試着將jar安裝到本地的maven倉庫中,但沒有成功。
如何配置此插件從項目文件夾中找到類?
什麼是文件夾結構如下。你有沒有使用maven簡單的原型生成一個初始的腳手架? –