maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slachiew...@apache.org
Subject [maven] 09/10: [MNG-6700] Equal compile source roots are added multiple times
Date Fri, 12 Jul 2019 16:43:18 GMT
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch jenkins-buld-error-wip
in repository https://gitbox.apache.org/repos/asf/maven.git

commit e7e9e25961b023e830f15ce63383978c2ec285b6
Author: Bo Zhang <bo@gradle.com>
AuthorDate: Sat Jul 6 08:26:26 2019 +0800

    [MNG-6700] Equal compile source roots are added multiple times
    
    This closes #266
---
 .../main/java/org/apache/maven/project/MavenProject.java    |  4 ++++
 .../java/org/apache/maven/project/MavenProjectTest.java     | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
index fd02557..bf10961 100644
--- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
+++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
@@ -304,6 +304,10 @@ public class MavenProject
                 {
                     path = file.getAbsolutePath();
                 }
+                else if ( ".".equals( path ) )
+                {
+                    path = getBasedir().getAbsolutePath();
+                }
                 else
                 {
                     path = new File( getBasedir(), path ).getAbsolutePath();
diff --git a/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java b/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
index 02d64b2..6b4258b 100644
--- a/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
@@ -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 ) );


Mime
View raw message