Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.3
-
None
-
Windows Vista SP1, Java 1.5.0_13, Maven 2.0.9
-
Patch
Description
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)
else
{ classpathElements.add( classesDirectory.getAbsolutePath() ); }}
Attachments
Attachments
Issue Links
- is duplicated by
-
SUREFIRE-504 own classes and test-classes at the end of test classpath
- Closed
-
SUREFIRE-517 Invalid classpath order with classesDirectory and testClassesDirectory
- Closed
- relates to
-
SUREFIRE-619 The surefire plugin should generate the test classpath
- Closed