You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2022/06/21 21:55:42 UTC

[maven] branch MNG-7501 updated (a3e2bbc20 -> a1a31f939)

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

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


 discard a3e2bbc20 try with CI if this is too much given using new File( "x/y" )
     new a1a31f939 force basedir as absolute path

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a3e2bbc20)
            \
             N -- N -- N   refs/heads/MNG-7501 (a1a31f939)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 .../maven/cli/event/ExecutionEventLoggerTest.java    | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)


[maven] 01/01: force basedir as absolute path

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

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

commit a1a31f939e328e027d1de00fd9b8e128dff421bc
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Tue Jun 21 19:09:50 2022 +0200

    force basedir as absolute path
---
 .../maven/cli/event/ExecutionEventLoggerTest.java    | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
index 225442845..5b924ece7 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
@@ -25,11 +25,11 @@ import static org.mockito.Mockito.when;
 
 import java.io.File;
 
+import org.apache.commons.io.FilenameUtils;
 import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.utils.logging.MessageUtils;
-import org.codehaus.plexus.util.Os;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -60,6 +60,7 @@ public class ExecutionEventLoggerTest
         when( logger.isInfoEnabled() ).thenReturn( true );
         executionEventLogger = new ExecutionEventLogger( logger );
 
+        File basedir = new File( "" ).getAbsoluteFile();
         ExecutionEvent event = mock( ExecutionEvent.class );
         MavenProject project = mock( MavenProject.class );
         when( project.getGroupId() ).thenReturn( "org.apache.maven" );
@@ -67,11 +68,11 @@ public class ExecutionEventLoggerTest
         when( project.getPackaging() ).thenReturn( "jar" );
         when( project.getName() ).thenReturn( "Apache Maven Embedder" );
         when( project.getVersion() ).thenReturn( "3.5.4-SNAPSHOT" );
-        when( project.getFile() ).thenReturn( new File( "maven-embedder/pom.xml" ) );
+        when( project.getFile() ).thenReturn( new File( basedir, "maven-embedder/pom.xml" ) );
         when( event.getProject() ).thenReturn( project );
 
         MavenProject rootProject = mock( MavenProject.class );
-        when( rootProject.getBasedir() ).thenReturn( new File( "" ) );
+        when( rootProject.getBasedir() ).thenReturn( basedir );
         MavenSession session = mock( MavenSession.class );
         when( session.getTopLevelProject() ).thenReturn( rootProject );
         when( event.getSession() ).thenReturn( session );
@@ -96,6 +97,7 @@ public class ExecutionEventLoggerTest
         when( logger.isInfoEnabled() ).thenReturn( true );
         executionEventLogger = new ExecutionEventLogger( logger );
 
+        File basedir = new File( "" ).getAbsoluteFile();
         ExecutionEvent event = mock( ExecutionEvent.class );
         MavenProject project = mock( MavenProject.class );
         when( project.getGroupId() ).thenReturn( "org.apache.maven.plugins.overflow" );
@@ -104,8 +106,8 @@ public class ExecutionEventLoggerTest
         when( project.getName() ).thenReturn( "Apache Maven Project Info Reports Plugin" );
         when( project.getVersion() ).thenReturn( "3.0.0-SNAPSHOT" );
         when( event.getProject() ).thenReturn( project );
-        when( project.getFile() ).thenReturn( new File( "pom.xml" ) );
-        when( project.getBasedir() ).thenReturn( new File( "" ) );
+        when( project.getFile() ).thenReturn( new File( basedir, "pom.xml" ) );
+        when( project.getBasedir() ).thenReturn( basedir );
 
         MavenSession session = mock( MavenSession.class );
         when( session.getTopLevelProject() ).thenReturn( project );
@@ -119,16 +121,12 @@ public class ExecutionEventLoggerTest
         inOrder.verify( logger ).info( "" );
         inOrder.verify( logger ).info( "--< org.apache.maven.plugins.overflow:maven-project-info-reports-plugin >--" );
         inOrder.verify( logger ).info( "Building Apache Maven Project Info Reports Plugin 3.0.0-SNAPSHOT" );
-        inOrder.verify( logger ).info( "  from pom.xml" );
+        inOrder.verify( logger ).info( adaptDirSeparator( "  from pom.xml" ) );
         inOrder.verify( logger ).info( "----------------------------[ maven-plugin ]----------------------------" );
     }
 
     private static String adaptDirSeparator( String path )
     {
-        if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
-        {
-            return path.replace( '/', '\\' );
-        }
-        return path;
+        return FilenameUtils.separatorsToSystem( path );
     }
 }