Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.0 (2.2 plugin)
-
Fix Version/s: 2.3.1
-
Component/s: JUnit 3.x support
-
Labels:None
-
Environment:maven2.0.4, sun-jdk-1.5.0.09, maven-surefire-plugin 2.2, surefire 2.0, gentoo linux x86
-
Patch Submitted:Yes
-
Number of attachments :
Description
Surefire incorrectly interprets classpath ordering.
Steps to reproduce:
1. unzip my-app.zip - it's a simple mvn project created with
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
and lightly patched
2. mvn test
in my case, it prints out
jar:file:/home/vyzivus/.m2/repository/jxta/jxta/2.0/jxta-2.0.jar!/log4j.properties
jar:file:/home/vyzivus/.m2/repository/jxta/jxta/2.0/jxta-2.0.jar!/log4j.properties
which is incorrect. log4j.properties is located both in jxta.jar and src/test/resources, but I think that src/test/resources takes precedence over jxta. This ordering is set correctly in surefire36745tmp file I think, but surefire seems to ignore the ordering.
Issue Links
- is duplicated by
-
SUREFIRE-289
Surefire classlaoder loads wrong class when classes are of same package/class name
-
- is related to
-
MNG-3118
Test-classes should come before classes in the classpath
-
- relates to
-
SUREFIRE-318
Fails to run build on Windows Server 2003
-
This seems to be due to adding classpath entries into the surefire properties file in the form of "classpath.[number]" and then these are getting sorted with a string sort. Therefore 29 classpath entries would be sorted as:
classPathUrl.9
classPathUrl.8
classPathUrl.7
classPathUrl.6
classPathUrl.5
classPathUrl.4
classPathUrl.3
classPathUrl.2
classPathUrl.1
classPathUrl.0
classPathUrl.29
classPathUrl.28
classPathUrl.27
classPathUrl.26
classPathUrl.25
classPathUrl.24
classPathUrl.23
classPathUrl.22
classPathUrl.21
classPathUrl.20
classPathUrl.19
classPathUrl.18
classPathUrl.17
classPathUrl.16
classPathUrl.15
classPathUrl.14
classPathUrl.13
classPathUrl.12
classPathUrl.11
classPathUrl.10
This then gets read back in via the SurefireBooter.main method (only if execution was forked) and never re-sorted by number to correct the order, thus causing the classpath to get loaded in the incorrect order.