我在尝试"清理安装时遇到此错误"与Maven的Spring项目。
以下是" maven-surefire-plugin"
的部分
<!-- BEGIN: Specific to mapping unit tests and covered code -->
<profiles>
<profile>
<id>coverage-per-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
<forkMode>always</forkMode>
<reportFormat>plain</reportFormat>
<trimStackTrace>false</trimStackTrace>
<properties>
<property>
<name>listener</name>
<value>org.sonar.java.jacoco.JUnitListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>sonar-jacoco-listeners</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<!-- END: Specific to mapping unit tests and covered code -->
并且出现了错误:
[INFO] BUILD FAILURE
[错误]无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:项目common-jpa2ddl上的test(default-test):存在测试失败。
[错误]无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:项目common-jpa2ddl上的test(default-test):存在测试失败。
[错误] - &gt; [帮助1]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整的调试日志记录。
[错误]有关错误和可能解决方案的更多信息,请阅读以下文章:
[错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.697 sec
Running com.teamwill.common.jpa2ddl.Jpa2DDLTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.011 sec <<< FAILURE!
initializationError(com.teamwill.common.jpa2ddl.Jpa2DDLTest) Time elapsed: 0.005 sec <<< ERROR!
java.lang.NoClassDefFoundError: org/eclipse/aether/RepositorySystemSession
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:18)
at org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:10)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:250)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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)
Caused by: java.lang.ClassNotFoundException: org.eclipse.aether.RepositorySystemSession
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 23 more
Results :
Tests in error:
initializationError(com.teamwill.common.jpa2ddl.Jpa2DDLTest): org/eclipse/aether/RepositorySystemSession
答案 0 :(得分:0)
尝试执行以下命令,以便Maven将更正所有依赖项及其后续条件 mvn依赖:树 这已经解决了类似的问题。