Mavenので、私はユニットテスト(maven-surefire-plugin
を使用して)と私のカスタムプラグインを構築しようとしていますが、私は次のようなエラーになっています:AssertionFailedError:Mavenの3.2.4以上が必要です(バージョン3.2.5を実行している)
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.aaa.bbb.maven.plugin.eee.dddTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec <<< FAILURE!
testSomething(com.aaa.bbb.maven.plugin.eee.dddTest) Time elapsed: 0.009 sec <<< FAILURE!
junit.framework.AssertionFailedError: Maven 3.2.4 or better is required
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:149)
at com.aaa.bbb.maven.plugin.eee.dddTest.setUp(dddTest.java:40)
at junit.framework.TestCase.runBare(TestCase.java:125)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:95)
at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:121)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Results :
Failed tests: testSomething(com.aaa.bbb.maven.plugin.eee.dddTest): Maven 3.2.4 or better is required
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.950 s
重要なラインビーイング:
junit.framework.AssertionFailedError: Maven 3.2.4 or better is required
しかし、私はバージョンを確認するとき、私は以下を参照してください
$ mvn -version
Apache Maven 3.2.5
-DskipTests
を使用してテストをスキップすると、正常に構築されています。このエラーはなぜ発生しますか?たぶんMaven 3.2.5が必要な依存関係がありますか?そして、なぜそれが正しいバージョンを検出していないのですか?
ご協力いただきありがとうございます。
P.S.このエラーは、特定のモジョを1つ追加した後に起こりました。私がモジョを取り除くと、うまくいく。モジョは何を引き起こしているのでしょうか?
EDIT:
私はdddTest.java
からSetup()
を除去し、私はまだちょうどラインを指定しなくても、同じエラーを取得しています。新しいエラー:
junit.framework.AssertionFailedError: Maven 3.2.4 or better is required
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:149)
at junit.framework.TestCase.runBare(TestCase.java:125)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:95)
at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:121)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
EDIT 2:
私は質問hereを見て、私は、依存関係のバージョンに問題があることを認識しています。そこで、リンクに記載されている依存関係のバージョンを更新し、さらにいくつか(依存関係のツリーをMavenの中心と比較することに基づいて)更新しました。バージョンを更新するたびに、エラーが変わります(ただし、テスト中にも発生します)。このエラーのために
java.lang.NoSuchMethodError: org.codehaus.plexus.ContainerConfiguration.setClassPathScanning(Ljava/lang/String;)Lorg/codehaus/plexus/ContainerConfiguration;
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setupContainerConfiguration(AbstractMojoTestCase.java:285)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setupContainer(AbstractMojoTestCase.java:259)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.getContainer(AbstractMojoTestCase.java:298)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:152)
at com.aaa.bbb.maven.plugin.eee.dddTest.setUp(dddTest.java:39)
at junit.framework.TestCase.runBare(TestCase.java:139)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
依存関係ツリー:そして今、私は次のエラーが直面しています
+- org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.5:provided
+- org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:3.3.0:test
| +- commons-io:commons-io:jar:2.2:compile
| \- org.codehaus.plexus:plexus-archiver:jar:2.2:test
| \- org.codehaus.plexus:plexus-io:jar:2.0.4:test
+- org.apache.maven:maven-artifact:jar:3.3.9:compile
| +- org.codehaus.plexus:plexus-utils:jar:3.0.22:compile
| \- org.apache.commons:commons-lang3:jar:3.4:compile
+- org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
| +- org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
| \- org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
+- org.yaml:snakeyaml:jar:1.17:compile
+- org.apache.commons:commons-compress:jar:1.14:compile
+- org.apache.maven.shared:maven-invoker:jar:3.0.0:compile
| \- org.codehaus.plexus:plexus-component-annotations:jar:1.7:compile
+- org.apache.maven:maven-core:jar:3.3.9:compile
| +- org.apache.maven:maven-model:jar:3.3.9:compile
| +- org.apache.maven:maven-settings:jar:3.3.9:compile
| +- org.apache.maven:maven-settings-builder:jar:3.3.9:compile
| | \- org.apache.maven:maven-builder-support:jar:3.3.9:compile
| +- org.apache.maven:maven-repository-metadata:jar:3.3.9:compile
| +- org.apache.maven:maven-plugin-api:jar:3.3.9:provided
| +- org.apache.maven:maven-model-builder:jar:3.3.9:compile
| | \- com.google.guava:guava:jar:18.0:compile
| +- org.apache.maven:maven-aether-provider:jar:3.3.9:compile
| | \- org.eclipse.aether:aether-spi:jar:1.0.2.v20150114:compile
| +- org.eclipse.aether:aether-impl:jar:1.0.2.v20150114:compile
| +- org.eclipse.aether:aether-api:jar:1.0.2.v20150114:compile
| +- org.eclipse.aether:aether-util:jar:1.0.2.v20150114:compile
| +- com.google.inject:guice:jar:no_aop:4.0:compile
| | +- javax.inject:javax.inject:jar:1:compile
| | \- aopalliance:aopalliance:jar:1.0:compile
| +- org.codehaus.plexus:plexus-classworlds:jar:2.5.2:compile
| \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
| \- org.sonatype.plexus:plexus-cipher:jar:1.4:compile
+- org.apache.maven:maven-plugin-descriptor:jar:2.2.1:compile
+- org.apache.maven.reporting:maven-reporting-exec:jar:1.3:compile
| +- org.apache.maven.reporting:maven-reporting-api:jar:3.0:compile
| | \- org.apache.maven.doxia:doxia-sink-api:jar:1.0:compile
| \- org.sonatype.aether:aether-util:jar:1.7:compile
+- org.apache.maven.shared:maven-shared-utils:jar:3.1.0:compile
+- org.codehaus.plexus:plexus-container-default:jar:1.7.1:compile
| +- org.apache.xbean:xbean-reflect:jar:3.7:compile
| \- com.google.collections:google-collections:jar:1.0:compile
+- junit:junit:jar:4.12:compile
| \- org.hamcrest:hamcrest-core:jar:1.3:compile
\- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.3:compile
+- javax.enterprise:cdi-api:jar:1.0:compile
| \- javax.annotation:jsr250-api:jar:1.0:compile
\- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.3:compile
任意の提案はどの依存関係のバージョンは、私が変更されなければなりませんか?
あなたのテストの1つが何かをチェックしているようです... – khmarbaise
私はそこに見るでしょう... com.aaa.bbb.maven.plugin.eee.dddTest.setUp'、line 40. –
@FlorianSchaetzが編集しました'setUp'を削除した後に新しいエラーが表示される –