1
ClassNotFoundException正在我開發的插件中拋出。不能founf類肯定存在,且其關聯的項目作爲執行的pom.xml的依賴如下包括:當在Mojo中使用@requiresDependencyResolution時,調試ClassNotFoundException拋出我的Maven Mojo
<dependency>
<groupId>com.example</groupId>
<artifactId>project-one</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
我的插件包含在執行的pom.xml如下:
<build>
<plugins>
<plugin>
<groupId>com.example</groupId>
<artifactId>project-two-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<configuration>
<customSettingOne>
setting
</customSettingOne>
</configuration>
<phase>prepare-package</phase>
<goals>
<goal>some-task</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
我的插件類如下:
/**
* @goal some-task
*
* @requiresDependencyResolution compile
*/
public class MyPluginMojo extends AbstractMojo {
/**
* Directory to save the CSV files to.
*
* @parameter alias="customSettingOne"
* @required
*/
private File customSettingOne;
}
我曾嘗試使用此代碼:
Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)
和使用的Eclipse M2E
Embedded (3.0.2/1.0.200.20111228-1245
我得到一個ClassNotFoundException時,我的插件代碼試圖從ProjectOne加載類的嵌入式版本。
任何人有任何想法,我怎麼能到這個底部?是否可以檢查或轉儲在插件中使用的類路徑?
謝謝!文檔幫助:特別是第3節。 – auser
maven3類加載指南:https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Class+Loading –