Tôi có một thử nghiệm đơn giản cho plugin maven:Các xét nghiệm cho maven plugin không phù hợp với 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();
}
}
với ví dụ maven-surefire-plugin cấu hình:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>never</forkMode>
</configuration>
</plugin>
</plugins>
</build>
Cho đến maven 3.0.4 đã được phát hành , SimpleMavenTest của tôi chạy thành công. Nhưng khi tôi chạy thử nghiệm sử dụng maven 3.0.4, lỗi tiếp theo đã xảy ra:
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)
Tôi nhìn ở đây: http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html và cố gắng thay đổi maven-surefire-plugin cấu hình theo cách như vậy:
<configuration>
<forkMode>once</forkMode>
</configuration>
Mọi thứ hoạt động tốt. Nhưng nếu tôi thực hiện:
<forkMode>never</forkMode>
lỗi trên xảy ra. Thật lạ lùng, bởi vì trên maven 3.0.3 và các phiên bản maven trước đó, thử nghiệm đã chạy mà không có bất kỳ lỗi nào. Bất kỳ ý tưởng?
Tôi có thiết lập tương tự nhưng tôi có thông tin phiên bản trên cấu hình chắc chắn của tôi được liệt kê như thế này $ {surefire.version} . không chắc chắn nếu nó có thể giúp đỡ. bạn có thể thử không? –
Venki
bạn có mục nhập cho id nhóm này trong pom của bạn không? org.apache.maven.wagon –
Venki
Tôi đã cố thêm $ {surefire.version} , nhưng lỗi lại xảy ra. Tôi có mục này: org.apache.maven.plugins . Tôi đã thay thế bằng thử của bạn: org.apache.maven.wagon và chạy thử thành công. Cảm ơn bạn đã giúp đỡ! Nhưng tôi cần nó hoạt động với org.apache.maven.plugins và như tôi đã viết ở trên, nó thú vị: tại sao nó hoạt động trên maven 3.0.3 và không hoạt động trên maven 3.0.4. –
rdiachenko