不相容我有Maven插件一个简单的测试:试验Maven插件是使用Maven 3.0.4
public class SimpleMavenTest extends AbstractMojoTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
// code
}
public void testCase() throws Exception {
// test case
}
@Override
protected void tearDown() throws Exception {
// code
super.tearDown();
}
}
这样的maven-surefire-plugin配置:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>never</forkMode>
</configuration>
</plugin>
</plugins>
</build>
直到行家3.0.4已经发布,我的SimpleMavenTest成功运行。但是,当我运行使用Maven 3.0.4的测试中,发生了一个错误:
java.lang.IllegalStateException: The internal default plexus-bootstrap.xml is missing. This is highly irregular, your plexus JAR is most likely corrupt.
at org.codehaus.plexus.DefaultPlexusContainer.initializeConfiguration(DefaultPlexusContainer.java:1052)
at org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer.java:627)
at org.codehaus.plexus.PlexusTestCase.setUp(PlexusTestCase.java:119)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:69)
at org.maven.test.MyMojoTest.setUp(MyMojoTest.java:12)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
我看这里:http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html并试图改变Maven的万无一失,插件在这样的方式配置:
<configuration>
<forkMode>once</forkMode>
</configuration>
一切工作正常。但是,如果我做:
<forkMode>never</forkMode>
上述错误发生。这很奇怪,因为在maven 3.0.3和以前的maven版本上测试运行没有任何错误。有任何想法吗?
我有类似的设置,但我有我的surefire配置上列出这样的版本信息 $ {surefire.version} 。不知道它是否有帮助。你可以试试吗? –
Venki
2012-02-10 18:34:41
你有没有在你的pom中输入这个组ID? org.apache.maven.wagon –
Venki
2012-02-10 18:38:06
我试图添加 $ {surefire.version} ,但错误再次发生。我有这个词条: org.apache.maven.plugins 。我用你的尝试替换它: org.apache.maven.wagon 并且测试运行成功。谢谢你的帮助! 但我需要它与 org.apache.maven.plugins 一起工作,正如我上面写的,这很有趣:为什么它在maven 3.0.3上工作,并且在maven 3.0.4上不起作用。 –
rdiachenko
2012-02-11 11:31:24