|
|
|
After a bit more research and testing I was able to create a patch for the surefire-booter revision 489098. Patch is attached.
Any hope on getting this fixed and released on the maven-surefire-plugin 2.2 branch?
Cannot reproduce with surefire 2.4-snapshot from trunk. The classpath seems ok:
It prints out the path to the target/test-classes/log4j.properties. There's no 'sort' anywhere in the surefire sources. Can you please check this again with the latest surefire snapshots to see if it's solved? 2.4-SNAPSHOT gives me the opposite result, i.e. target/class first, then target/test-classes, then dependencies. As does 2.3.
I have attached output of the following commands: mvn archetype:create -DgroupId=test -DartifactId=classpath_test -DarchetypeArtifactId=maven-archetype-quickstart Note this bit: [DEBUG] Test Classpath : This is causing me some major problems now. Can anyone comment in any way on why I'm getting an ordering of target/classes before target/test-classes in the example above? I have to go back to 2.1.3 to find a version that puts target/test-classes in front of target/classes.
I've checked out the surefire code and SurefirePlugin.java - line 649 says:
// no need to add classes/test classes directory here - they are in the classpath elements already I'm having major problems digging out exactly what is putting these directories on the classpath in the first place - it doesn't seem to be the responsibility of the SureFire plugin but perhaps passed in from Plexus? Can anyone point me in the right direction? This issue is blocking a major release for me and I'm looking for as much help as possible. i'll certainly supply the patch if I get to the bottom of this! The issue can be seen mainly when the fork mode is set to never. Because if the surefire plugin forks, then the ordering gets rearranged similar to what Barrett described. However, I think this is caused by loading the paths into the properties object and then using an enumeration to iterate through them. The Properties object doesn't retain the order of the loaded props, so they really could come out in any order, not just the sorted order that is shown above.
So I think that Barrett's approach is the right one. The classpath elements really need to be sorted after they are loaded from properties file. Hopefully someone will apply his patch or something similar to it soon |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.