maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Sewe (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (SUREFIRE-708) Test-classified but compile-scoped dependency causes NoClassDefFoundError: org/junit/runner/notification/RunListener
Date Fri, 04 Mar 2011 21:52:22 GMT

    [ http://jira.codehaus.org/browse/SUREFIRE-708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=258599#action_258599
] 

Andreas Sewe commented on SUREFIRE-708:
---------------------------------------

With respect to the test project's completeness: the {{pom.xml}} is all you need, but if you
really want to, feel free to add {{src/main/java}} and {{src/test/java}} directories; this
doesn't change anything.

However, it seems that deleting the local repository fixed the problem for me. :-) I'll try
to figure out what the difference were between the new and the old local repository.

> Test-classified but compile-scoped dependency causes NoClassDefFoundError: org/junit/runner/notification/RunListener
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-708
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-708
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading, Maven Surefire Plugin
>    Affects Versions: 2.7.2
>         Environment: Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100)
> Java version: 1.6.0_22, vendor: Apple Inc.
> Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x", version: "10.6.6", arch: "x86_64", family: "mac"
>            Reporter: Andreas Sewe
>            Priority: Blocker
>         Attachments: pom.xml
>
>
> I have a real-world project which has a {{test}}-classified third-party dependency that
is (out of necessity) {{compile}}-scoped rather then {{test}}-scoped (as the test-JAR unfortunately
contains classes also useful outside of a testing context). This constellation causes the
{{maven-surefire-plugin}} to fail with a {{NoClassDefFoundError}}, thus effectively preventing
the project from being build:
> {quote}
> java.lang.NoClassDefFoundError: org/junit/runner/notification/RunListener
> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
> 	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> 	at java.lang.Class.getConstructor0(Class.java:2699)
> 	at java.lang.Class.getConstructor(Class.java:1657)
> 	at org.apache.maven.surefire.util.ReflectionUtils.getConstructor(ReflectionUtils.java:76)
> 	at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:129)
> 	at org.apache.maven.surefire.booter.SurefireReflector.instantiateProvider(SurefireReflector.java:198)
> 	at org.apache.maven.surefire.booter.ProviderFactory.createProvider(ProviderFactory.java:72)
> 	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:146)
> 	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
> Caused by: java.lang.ClassNotFoundException: org.junit.runner.notification.RunListener
> 	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:307)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> 	at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:93)
> 	... 11 more
> {quote}
> Attached is a minimal Maven project (just the POM; whether there are test sources present
doesn't change the outcome) that reproduces this problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message