maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Sewe (JIRA)" <>
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


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:
>             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(
> 	at java.lang.Class.getConstructor0(
> 	at java.lang.Class.getConstructor(
> 	at org.apache.maven.surefire.util.ReflectionUtils.getConstructor(
> 	at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(
> 	at org.apache.maven.surefire.booter.SurefireReflector.instantiateProvider(
> 	at org.apache.maven.surefire.booter.ProviderFactory.createProvider(
> 	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(
> 	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(
> Caused by: java.lang.ClassNotFoundException: org.junit.runner.notification.RunListener
> 	at$
> 	at Method)
> 	at
> 	at java.lang.ClassLoader.loadClass(
> 	at java.lang.ClassLoader.loadClass(
> 	at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(
> 	... 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:
For more information on JIRA, see:


View raw message