[jbosstools-issues] [JBoss JIRA] (JBIDE-14396) Imported maven projects sometimes fail to resolve required classpath dependencies for tests

Fred Bricon (JIRA) jira-events at lists.jboss.org
Mon May 13 06:34:06 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-14396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773705#comment-12773705 ] 

Fred Bricon commented on JBIDE-14396:
-------------------------------------

m2e doesn't know how to handle the forge-addon classifier  from workspace projects. Should all the classes be available? or a subset?

Igor and I disagree on the way to treat unknown classifiers, so I came up with a small API you'd have to use/extend to try to deal with unknown classifiers. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=368230 and https://github.com/eclipse/m2e-core/commit/c30ebdb14e18906e4ef1be233946669f3459155d

Basically, one has to create a new m2e-forge plugin providing a ForgeAddonClassifierClasspathProvider. yes I know it's lame.
                
> Imported maven projects sometimes fail to resolve required classpath dependencies for tests
> -------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-14396
>                 URL: https://issues.jboss.org/browse/JBIDE-14396
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: maven
>    Affects Versions: 4.1.0.Alpha2
>            Reporter: Lincoln Baxter III
>
> Example project: https://github.com/forge/core/tree/M2ECLIPSE-BUG
> Steps to reproduce:
> * Import all modules into the workspace. 
> * Select "aesh-tests" project.
> * Run as -> JUnit Test
> You should see the test fail to launch because of the following Class not found exception:
> {code}
> java.lang.NoClassDefFoundError: Lorg/jboss/forge/aesh/TestShellConfiguration;
> 	at java.lang.Class.getDeclaredFields0(Native Method)
> 	at java.lang.Class.privateGetDeclaredFields(Class.java:2300)
> 	at java.lang.Class.getDeclaredFields(Class.java:1745)
> 	at org.junit.runners.model.TestClass.<init>(TestClass.java:49)
> 	at org.junit.runners.ParentRunner.<init>(ParentRunner.java:75)
> 	at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57)
> 	at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:50)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
> 	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
> 	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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.lang.ClassNotFoundException: org.jboss.forge.aesh.TestShellConfiguration
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 25 more
> {code}
> This can be solved by manually adding required projects in the workspace as classpath dependencies of the JUnit launch configured for the project being tested, but this is obviously not right, and should be configured automatically by the M2E integration.

--
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


More information about the jbosstools-issues mailing list