« Return to Thread: Surefire 2.4.1 classpath order

Re: Surefire 2.4.1 classpath order

by dfabulich :: Rate this Message:

Reply to Author | View in Thread

Ben Lidgey wrote:

> We are running tests using Surefire 2.4.1 and Maven 2.0.8.
[...]

> Looking at the debug output shows:
>
> [DEBUG] Test Classpath :
> [DEBUG]   C:\Documents and Settings\benl\.m2\repository\junit\junit\4.2\junit-4.2.jar
>
> [more jars]
>
> [DEBUG]   c:\Development\Projects\MyProject\target\classes
> [DEBUG]   c:\Development\Projects\MyProject\target\test-classes
>
> Which would explain it. Is there anyway to get the test-classes before
> classes in the classpath order? Setting childDelegation to true doesn't.

I'm not 100% certain you're using the software you think you're using;
here's some debugging/analysis tips.

Take a look at http://jira.codehaus.org/browse/MNG-3118.  That bug was
fixed in Maven 2.0.8 and called out in the release announcement as a
backwards compatibility risk:

http://www.mail-archive.com/announce@.../msg00432.html

As noted in MNG-3118, Surefire 2.3 had a bizarre classpath ordering bug
that made the test classpath appear to be correct (test-classes first)
under Maven 2.0.7 for some users with large classpaths:

http://jira.codehaus.org/browse/SUREFIRE-61

SUREFIRE-61 was fixed in Surefire 2.3.1.  Notably, it would make the "Test
Classpath" output in -X look correct, while secretly under the hood it
would munge the classpath incorrectly!

As a result, for at least one project here at my work, we've seen:

Maven 2.0.7 + Surefire 2.3: test-classes before classes
Maven 2.0.8 + Surefire 2.3: classes before test-classes
Maven 2.0.7 + Surefire 2.3.1 or higher: classes before test-classes
Maven 2.0.8 + Surefire 2.3.1 or higher: test-classes before classes

Benjamin checked in a classpath ordering test in the Surefire trunk that
we now run with every release.  It's currently passing for me with
Surefire 2.4.1 (and 2.4.2-SNAPSHOT) and Maven 2.0.8, and failing with
Maven 2.0.7.

Finally, note that your "real" classpath is being output in your
target/surefire-reports/*.xml files as the "surefire.test.classpath"
property; that may be useful for debugging purposes.

-Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: Surefire 2.4.1 classpath order