You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org> on 2011/01/04 21:25:58 UTC

[jira] Closed: (SUREFIRE-641) junit drops from classpath when using a specific testClassesDirectory

     [ http://jira.codehaus.org/browse/SUREFIRE-641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold closed SUREFIRE-641.
---------------------------------------

       Resolution: Cannot Reproduce
    Fix Version/s: 2.7.2
         Assignee: Kristian Rosenvold

I cannot reproduce this bug with an isolated test case.

I see from your log file that you are picking up 2 different versions of junit from your project classpath, version 4.0 and 4.5:

[DEBUG] Adding to surefire test classpath: /Users/benson/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.5/surefire-junit4-2.5.jar
[DEBUG] Adding to surefire test classpath: /Users/benson/.m2/repository/junit/junit/4.0/junit-4.0.jar
[DEBUG] Adding to surefire test classpath: /Users/benson/.m2/repository/org/apache/maven/surefire/surefire-api/2.5/surefire-api-2.5.jar
[DEBUG] Test Classpath :
[DEBUG]   /Users/benson/x/rap/ras/rex_ws_integration_tests/target/rex-ws-test-classes
[DEBUG]   /Users/benson/x/rap/ras/rex_ws_integration_tests/target/classes
[DEBUG]   /Users/benson/.m2/repository/junit/junit/4.5/junit-4.5.jar

I am almost certain this is the root cause of your problem. You could use tools like mvn dependency:tree to determine where the incorrect version of the dependency is coming from, and you can suppress its inclusion.

As for "why" 2 different versions of this dependency are being picked I will only say this much: The log reveals you are using maven 2.1.0; I will not investigate this issue based on 2.1.0. The dependency resolution algorithms are vastly improved in 3.X. If you must stay on 2.x, supression is your friend.

> junit drops from classpath when using a specific testClassesDirectory
> ---------------------------------------------------------------------
>
>                 Key: SUREFIRE-641
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-641
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.6
>            Reporter: Benson Margulies
>            Assignee: Kristian Rosenvold
>             Fix For: 2.7.2
>
>         Attachments: pom.xml, sf.log
>
>
> To run some tests from a jar, I went through the process of unpacking the jar and configuring it as a testClassesDirectory.
> Upon execution, I am rewarded with:
> org.apache.maven.lifecycle.LifecycleExecutionException: Assert; nested exception is java.lang.NoClassDefFoundError: Assert
> It fails the same with 2.5 and 2.6. I will attach the entire POM so that you can see that junit most assuredly is in the classpath. The -X log I'll attach also shows it, just to make this maximally confusing.
> Config is:
> {code}
>   <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.5</version>
>                 <executions>
>                     <execution>
>                         <id>rex-ws-tests</id>
>                         <phase>test</phase>
>                         <goals>
>                             <goal>test</goal>
>                         </goals>
>                         <configuration>
>                             <testClassesDirectory>${project.build.directory}/rex-ws-test-classes</testClassesDirectory>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
> {code}
>    

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