maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Sewe (JIRA)" <>
Subject [jira] Created: (SUREFIRE-708) Test-classified but compile-scoped dependency causes NoClassDefFoundError: org/junit/runner/notification/RunListener
Date Tue, 01 Mar 2011 23:22:23 GMT
Test-classified but compile-scoped dependency causes NoClassDefFoundError: org/junit/runner/notification/RunListener

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

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 Method)
	at java.lang.ClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(
	... 11 more

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