我試圖使用2.1 maven-plugin-testing-harness
版本具有以下測試案例:組件查找例外Maven插件測試
public class FooTest extends AbstractMojoTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
public void testSomething() throws Exception {
// todo
}
}
測試失敗在setUp()
電話:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
role: org.apache.maven.repository.RepositorySystem
roleHint:
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
at org.codehaus.plexus.PlexusTestCase.lookup(PlexusTestCase.java:206)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:118)
at foo.FooTest.setUp(FooTest.java:54)
這些依賴我在pom.xml
:
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
有何想法?
我也有這個問題。我不認爲你找到了解決方案嗎? – ksclarke
不,還沒有.. – yegor256
可能的重複:http://stackoverflow.com/questions/14939341/error-injecting-defaultrepositorysystem-in-maven-plugin-testing-harness。我也有這個問題。 – Noremac