You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2019/07/06 08:19:43 UTC

[maven] branch MNG-6700 created (now c68ec10)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MNG-6700
in repository https://gitbox.apache.org/repos/asf/maven.git.


      at c68ec10  [MNG-6700] Same compile source roots are added multiple times

This branch includes the following new commits:

     new c68ec10  [MNG-6700] Same compile source roots are added multiple times

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven] 01/01: [MNG-6700] Same compile source roots are added multiple times

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-6700
in repository https://gitbox.apache.org/repos/asf/maven.git

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

    [MNG-6700] Same compile source roots are added multiple times
    
    Maven 3.6.1 introduces a bug that basedir and "." can be added twice to `compileSourceRoots`,
    which breaks some compiler plugin. This commit fixes this issue by correctly normailzing "."
    when it's added to `compileSourceRoots`.
---
 .../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 ) );