Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.1
-
None
-
None
-
Maven 3.0.4, JDK 1.7, MacOSx
Description
I'm trying to extend an existing project using p.-t.-hatness.
So I added to my project dependency:
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
And extended the test class follow the quick start guide.
On the first run I have following exception:
rg.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
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:601)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: java.lang.NoClassDefFoundError: org/sonatype/aether/RepositorySystemSession
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getMethod0(Class.java:2685)
at java.lang.Class.getMethod(Class.java:1620)
at org.apache.maven.surefire.common.junit3.JUnit3Reflector.createInstanceFromSuiteMethod(JUnit3Reflector.java:152)
at org.apache.maven.surefire.common.junit3.JUnit3Reflector.constructTestObject(JUnit3Reflector.java:121)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:71)
at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:117)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:94)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.RepositorySystemSession
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 18 more
It loks like the Aether classes are not found. So I simply added dependency:
<dependency>
<groupId>com.rempl</groupId>
<artifactId>rempl-cli</artifactId>
<version>1.1.3</version>
<classifier>bin</classifier>
<scope>test</scope>
</dependency>
And now I have exception:
Caused by: java.lang.ClassNotFoundException: org.apache.maven.execution.MavenExecutionRequest
That's funny because MavenExecutionRequest is a part of the Maven core and should be just available. Anyway I checked what's happend if I will add maven-core manually. When adding dependency:
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven-version}</version>
<scope>test</scope>
</dependency>
I have another error:
Caused by: java.lang.ClassNotFoundException: org.apache.maven.execution.MavenExecutionResult
Hmmm... This is also a part of maven-core. This brings me to the conclusion, that trying to add dependencies manually was was a bad idea and there must be another solution.
I will appreciative for any idea what can I do.