[MNG-6700] Equal compile source roots are added multiple times

This closes #266
This commit is contained in:
Bo Zhang 2019-07-06 08:26:26 +08:00 committed by Michael Osipov
parent 8da81ce73c
commit 84bf1877f0
2 changed files with 17 additions and 0 deletions

View File

@ -304,6 +304,10 @@ public class MavenProject
{
path = file.getAbsolutePath();
}
else if ( ".".equals( path ) )
{
path = getBasedir().getAbsolutePath();
}
else
{
path = new File( getBasedir(), path ).getAbsolutePath();

View File

@ -198,6 +198,19 @@ public class MavenProjectTest
assertNoNulls( p.getTestClasspathElements() );
}
public void testAddDotFile()
{
MavenProject project = new MavenProject();
File basedir = new File( System.getProperty( "java.io.tmpdir" ) );
project.setFile( new File( basedir, "file" ) );
project.addCompileSourceRoot( basedir.getAbsolutePath() );
project.addCompileSourceRoot( "." );
assertEquals( 1, project.getCompileSourceRoots().size() );
}
private void assertNoNulls( List<String> elements )
{
assertFalse( elements.contains( null ) );