Does anybody know how to change it ?
I mean from
target/test-classes ... target/classes .... maven dependencies
to
target/test-classes ... maven dependencies .... target/classes
It relates to this surefire-plugin feature request
It's because surefire-plugin cannot include/exclude resources from /target/classes ... it can only include/exlude resources via <testResources>
element which can affect only /target/test-classes, not /target/classes
It all happens here in Surefire-plugin :
File projectClassesDirectory = new File( project.getBuild().getOutputDirectory() );
if ( !projectClassesDirectory.equals( classesDirectory ) )
{
int indexToReplace = classpathElements.indexOf( project.getBuild().getOutputDirectory() );
if ( indexToReplace != -1 )
{
classpathElements.remove( indexToReplace );
classpathElements.add( indexToReplace, classesDirectory.getAbsolutePath() );
}
else
{
classpathElements.add( 1, classesDirectory.getAbsolutePath() );
}
}
File projectTestClassesDirectory = new File( project.getBuild().getTestOutputDirectory() );
if ( !projectTestClassesDirectory.equals( testClassesDirectory ) )
{
int indexToReplace = classpathElements.indexOf( project.getBuild().getTestOutputDirectory() );
if ( indexToReplace != -1 )
{
classpathElements.remove( indexToReplace );
classpathElements.add( indexToReplace, testClassesDirectory.getAbsolutePath() );
}
else
{
classpathElements.add( 0, testClassesDirectory.getAbsolutePath() );
}
}
getLog().debug( "Test Classpath :" );
for ( Iterator i = classpathElements.iterator(); i.hasNext(); )
{
String classpathElement = (String) i.next();
getLog().debug( " " + classpathElement );
surefireBooter.addClassPathUrl( classpathElement );
}