You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Ben Lidgey (JIRA)" <ji...@codehaus.org> on 2008/02/22 10:26:29 UTC

[jira] Created: (MNG-3416) Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.

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

                 Key: MNG-3416
                 URL: http://jira.codehaus.org/browse/MNG-3416
             Project: Maven 2
          Issue Type: Bug
          Components: Inheritance and Interpolation
    Affects Versions: 2.0.8
            Reporter: Ben Lidgey


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:
{code:xml}
<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>
{code}

Changing just testOutputDirectory to
{code:xml}
<testOutputDirectory>target/test-classes</testOutputDirectory>
{code}

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

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

        

[jira] Commented: (MNG-3416) Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.

Posted by "Ben Lidgey (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=138510#action_138510 ] 

Ben Lidgey commented on MNG-3416:
---------------------------------

I've not noticed in 2.0.9, but haven't deliberately tested for it either.


> Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.
> ------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3416
>                 URL: http://jira.codehaus.org/browse/MNG-3416
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>    Affects Versions: 2.0.8
>            Reporter: Ben Lidgey
>             Fix For: 2.0.x
>
>
> 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:
> {code:xml}
> <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>
> {code}
> Changing just testOutputDirectory to
> {code:xml}
> <testOutputDirectory>target/test-classes</testOutputDirectory>
> {code}
> Made the tests pass. I've no idea why.

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

        

[jira] Closed: (MNG-3416) Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter closed MNG-3416.
-----------------------------

       Resolution: Cannot Reproduce
    Fix Version/s:     (was: 2.2.x (to be reviewed))

please let us know if it continues to be an issue in recent versions

> Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.
> ------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3416
>                 URL: http://jira.codehaus.org/browse/MNG-3416
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>    Affects Versions: 2.0.8
>            Reporter: Ben Lidgey
>
> 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:
> {code:xml}
> <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>
> {code}
> Changing just testOutputDirectory to
> {code:xml}
> <testOutputDirectory>target/test-classes</testOutputDirectory>
> {code}
> Made the tests pass. I've no idea why.

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

        

[jira] Commented: (MNG-3416) Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.

Posted by "Ben Lidgey (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_124642 ] 

Ben Lidgey commented on MNG-3416:
---------------------------------

See http://www.nabble.com/Surefire-2.4.1-classpath-order-td15498825s177.html for the maven-users thread.

> Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.
> ------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3416
>                 URL: http://jira.codehaus.org/browse/MNG-3416
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>    Affects Versions: 2.0.8
>            Reporter: Ben Lidgey
>
> 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:
> {code:xml}
> <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>
> {code}
> Changing just testOutputDirectory to
> {code:xml}
> <testOutputDirectory>target/test-classes</testOutputDirectory>
> {code}
> Made the tests pass. I've no idea why.

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

        

[jira] Updated: (MNG-3416) Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated MNG-3416:
------------------------------

    Fix Version/s: 2.0.x

is this still an issue in 2.0.9?

> Setting testOutDirectory to ${basedir}/target/test-classes causes test classpath to be reversed.
> ------------------------------------------------------------------------------------------------
>
>                 Key: MNG-3416
>                 URL: http://jira.codehaus.org/browse/MNG-3416
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>    Affects Versions: 2.0.8
>            Reporter: Ben Lidgey
>             Fix For: 2.0.x
>
>
> 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:
> {code:xml}
> <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>
> {code}
> Changing just testOutputDirectory to
> {code:xml}
> <testOutputDirectory>target/test-classes</testOutputDirectory>
> {code}
> Made the tests pass. I've no idea why.

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