[
http://jira.codehaus.org/browse/SUREFIRE-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul Gier closed SUREFIRE-504.
------------------------------
Resolution: Duplicate
Duplicate of SUREFIRE-502
> own classes and test-classes at the end of test classpath
> ---------------------------------------------------------
>
> Key: SUREFIRE-504
> URL: http://jira.codehaus.org/browse/SUREFIRE-504
> Project: Maven Surefire
> Issue Type: Bug
> Components: plugin
> Affects Versions: 2.4
> Environment: Maven 2.0.9, Windows XP
> Reporter: Torsten Reinhard
> Assignee: Paul Gier
> Fix For: 2.5
>
>
> Own classes and test-classes may be added to the end of the classpath:
> [DEBUG] Adding to surefire test classpath:
> s:\mavenrepo\org\apache\maven\surefire\surefire-api\2.4\surefire-api-2.4.jar
> [DEBUG] Test Classpath :
> [DEBUG] s:\mavenrepo\log4j\log4j\1.2.13\log4j-1.2.13.jar
> ...
> [DEBUG] s:\mavenrepo\org\apache\xmlsec\1.4.1\xmlsec-1.4.1.jar
> [DEBUG] S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\classes
> [DEBUG] S:\pdv_cms\GDCAMS\src\pip\gdcams-pip-itest\target\test-classes
> This may happen, when you add the following terms to a parent pom.xml:
> <properties>
> <target.dir>target</target.dir>
> </properties>
> <build>
> ....
> <!-- special (output)Directory for Eclipse -->
> <!-- see
> http://docs.codehaus.org/display/M2ECLIPSE/Project+FAQ#ProjectFAQ-HowtoconfigureMavenprojecttouseseparateoutputfoldersinEclipse--
> >
>
> <outputDirectory>${project.basedir}/${target.dir}/classes</outputDirectory>
>
> <testOutputDirectory>${project.basedir}/${target.dir}/test-classes</testOutputDirectory>
>
> ....
> </build>
> <profiles>
> <profile>
> <id>eclipse-folders</id>
> <properties>
> <target.dir>target-eclipse</target.dir>
> </properties>
> </profile>
> </profiles>
> The reason for that is:
> SurefirePlugin#constructSurefireBooter changes the classpath by doing:
> ...
> getLog().debug( "Test Classpath :" );
> // Check if we need to add configured classes/test classes
> directories here.
> // If they are configured, we should remove the default to avoid
> conflicts.
> if ( !project.getBuild().getOutputDirectory().equals(
> classesDirectory.getAbsolutePath() ) )
> {
> classpathElements.remove( project.getBuild().getOutputDirectory()
> );
> classpathElements.add( classesDirectory.getAbsolutePath() );
> }
> if ( !project.getBuild().getTestOutputDirectory().equals(
> testClassesDirectory.getAbsolutePath() ) )
> {
> classpathElements.remove(
> project.getBuild().getTestOutputDirectory() );
> classpathElements.add( testClassesDirectory.getAbsolutePath() );
> }
> ...
> project.getBuild().getOutputDirectory() is like "${basedir}/target/classes"
> classesDirectory.getAbsolutePath() is: "${basedir}\target\classes"
> So i think here a 2 bugs:
> (1) files/directories shouldn´t be compared just as String.equals(....) -
> using File.compareTo may be a better solution
> (2) an Element of classpathElements shouldn´t be removed and added to the end
> of the ArrayList, it should be replaced at the same position.
--
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