[ http://jira.codehaus.org/browse/SUREFIRE-502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Gier updated SUREFIRE-502: ------------------------------- Assignee: Paul Gier Fix Version/s: 2.5 > Specified classesDirectory is added to the end of the classpath > --------------------------------------------------------------- > > Key: SUREFIRE-502 > URL: http://jira.codehaus.org/browse/SUREFIRE-502 > Project: Maven Surefire > Issue Type: Bug > Components: classloading > Affects Versions: 2.4.3 > Environment: Windows Vista SP1, Java 1.5.0_13, Maven 2.0.9 > Reporter: James Shiell > Assignee: Paul Gier > Fix For: 2.5 > > Attachments: SUREFIRE-502.patch, SurefirePlugin.java > > > When you specify a classesDirectory in the configuration element of the > Surefire plugin definition the classesDirectory is appended to the end of the > classpath rather than replacing the build output directory. This means > included dependencies take precedence over your source code. > The problem appears to be the following code: > if ( !project.getBuild().getOutputDirectory().equals( > classesDirectory.getAbsolutePath() ) ) > { > classpathElements.remove( project.getBuild().getOutputDirectory() > ); > classpathElements.add( classesDirectory.getAbsolutePath() ); > } > The classes directory should replace the build output directory, e.g. > if ( !project.getBuild().getOutputDirectory().equals( > classesDirectory.getAbsolutePath() ) ) > { > final int replacementIndex = > classpathElements.indexOf(project.getBuild().getOutputDirectory()); > if (replacementIndex >= 0) > { > classpathElements.remove( > project.getBuild().getOutputDirectory() ); > classpathElements.add( replacementIndex, > classesDirectory.getAbsolutePath() ); > } > else > { > classpathElements.add( classesDirectory.getAbsolutePath() > ); > } > } -- 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