Issue Details (XML | Word | Printable)

Key: MNG-3416
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Ben Lidgey
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 2

Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.

Created: 22/Feb/08 03:25 AM   Updated: 13/Jun/08 04:19 AM
Component/s: Inheritance and Interpolation
Affects Version/s: 2.0.8
Fix Version/s: 2.0.x

Time Tracking:
Not Specified


 Description  « Hide
Environment: maven 2.0.8, surefire 2.4.1,2.4.2

We are running tests using Surefire 2.4.1 and Maven 2.0.8. The Junit test classes are expecting to load a properties file from
src/test/resources with the same name as a properties file in src/main/resources to load test data etc. However the src/main/resources properties file is being loaded.

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. Setting childDelegation to true doesn't get the test-classes before classes in the classpath order.

I generated the effective-pom and used it in a copy of the Surefire integration test for the classpath order (http://svn.apache.org/repos/asf/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order). The tests failed. I then trawled through the project POM and then its parent POM commenting out plugins, reporting, dependencies, and other bits until the test passed.

The thing that was causing the test to fail was that in the parent POM:

<defaultGoal>package</defaultGoal>
<directory>target</directory>
<finalName>${pom.artifactId}-${pom.version}</finalName>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>

Changing just testOutputDirectory to

<testOutputDirectory>target/test-classes</testOutputDirectory>

Made the tests pass. I've no idea why.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ben Lidgey added a comment - 22/Feb/08 03:26 AM

Brett Porter added a comment - 12/Jun/08 08:22 PM
is this still an issue in 2.0.9?

Ben Lidgey added a comment - 13/Jun/08 04:19 AM
I've not noticed in 2.0.9, but haven't deliberately tested for it either.