maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject [maven-release] branch Paths updated: Try if ReleaseUtil.isSymlink() can be replaced
Date Fri, 23 Mar 2018 10:41:11 GMT
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch Paths
in repository https://gitbox.apache.org/repos/asf/maven-release.git


The following commit(s) were added to refs/heads/Paths by this push:
     new d02c289  Try if ReleaseUtil.isSymlink() can be replaced
d02c289 is described below

commit d02c28916d2b7381aa1b6c561ff190479d6f42d1
Author: rfscholte <rfscholte@apache.org>
AuthorDate: Fri Mar 23 11:41:04 2018 +0100

    Try if ReleaseUtil.isSymlink() can be replaced
---
 .../maven/shared/release/phase/CheckoutProjectFromScm.java  | 11 ++++++-----
 .../maven/shared/release/DefaultReleaseManagerTest.java     | 13 +++++++++----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
index 60f78b8..18a87e7 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
@@ -21,6 +21,7 @@ package org.apache.maven.shared.release.phase;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.LinkOption;
 import java.util.List;
 
 import org.apache.maven.project.MavenProject;
@@ -232,18 +233,18 @@ public class CheckoutProjectFromScm
                     + e.getMessage(), e );
             }
 
-            String rootProjectBasedir = rootProject.getBasedir().getAbsolutePath();
+            String rootProjectBasedir;
             try
             {
-                if ( ReleaseUtil.isSymlink( rootProject.getBasedir() ) )
-                {
-                    rootProjectBasedir = rootProject.getBasedir().getCanonicalPath();
-                }
+                rootProjectBasedir =
+                    rootProject.getBasedir().toPath().toRealPath( LinkOption.NOFOLLOW_LINKS
).toString();
             }
             catch ( IOException e )
             {
                 throw new ReleaseExecutionException( e.getMessage(), e );
             }
+            
+            
             if ( rootProjectBasedir.length() > basedir.length() )
             {
                 scmRelativePathProjectDirectory = rootProjectBasedir.substring( basedir.length()
+ 1 );
diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
b/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
index 142d49b..47cc88b 100644
--- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
+++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
@@ -458,12 +458,17 @@ public class DefaultReleaseManagerTest
         verifyNoMoreInteractions( configStoreMock );
     }
 
-
-
-    private static List<MavenProject> createReactorProjects()
+    private static List<MavenProject> createReactorProjects() throws IOException
     {
         MavenProject project = new MavenProject();
-        project.setFile( getTestFile( "target/dummy-project/pom.xml" ) );
+        
+        File projectFile = getTestFile( "target/dummy-project/pom.xml" );
+        if ( !projectFile.exists() )
+        {
+            projectFile.getParentFile().mkdirs();
+            projectFile.createNewFile();
+        }
+        project.setFile( projectFile );
         return Collections.singletonList( project );
     }
 

-- 
To stop receiving notification emails like this one, please contact
rfscholte@apache.org.

Mime
View raw message