You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Artur Keska (JIRA)" <ji...@codehaus.org> on 2013/05/24 10:06:52 UTC

[jira] (MPLUGINTESTING-27) ClassDefNotFound exception

Artur Keska created MPLUGINTESTING-27:
-----------------------------------------

             Summary: ClassDefNotFound exception
                 Key: MPLUGINTESTING-27
                 URL: https://jira.codehaus.org/browse/MPLUGINTESTING-27
             Project: Maven 2.x Plugin Testing
          Issue Type: Bug
          Components: plugin-testing-harness
    Affects Versions: 2.1
         Environment: Maven 3.0.4, JDK 1.7, MacOSx
            Reporter: Artur Keska


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira