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

[maven] branch MNG-7131 updated (194f08f -> e503b75)

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

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


 discard 194f08f  [MNG-7131] maven.config doesn't handle arguments with spaces in them
     add e8b9cad  Wrap line in consistency with Command script
     add e9a54c6  Use proper term: directory
     add 94df4a8  Apply consistent formatting
     add 8712063  [MNG-7190] Load mavenrc from /usr/local/etc also in Bourne shell script
     new e503b75  [MNG-7131] maven.config doesn't handle arguments with spaces in them

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   (194f08f)
            \
             N -- N -- N   refs/heads/MNG-7131 (e503b75)

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:
 apache-maven/src/assembly/shared/init.cmd          |  2 +-
 apache-maven/src/assembly/shared/run               |  3 ++-
 apache-maven/src/assembly/shared/validate          |  8 ++++++--
 .../collector/MultiModuleCollectionStrategy.java   |  2 +-
 .../collector/PomlessCollectionStrategy.java       |  2 +-
 .../project-builder/it0063/jdk/jre/placeholder.txt |  2 +-
 .../it0063/jdk/jre/placeholder.txt                 |  2 +-
 .../java/org/apache/maven/cli/MavenCliTest.java    | 22 ++++++++++++++--------
 .../mavenConfigProperties/.mvn/maven.config        |  3 ++-
 9 files changed, 29 insertions(+), 17 deletions(-)

[maven] 01/01: [MNG-7131] maven.config doesn't handle arguments with spaces in them

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

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

commit e503b758ff647f71218e194cc0fc1e7ba60768bd
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Jul 15 18:55:16 2021 +0200

    [MNG-7131] maven.config doesn't handle arguments with spaces in them
    
    Since we don't have a clear specification of the file format change
    reading of the file to a one-arg-per-line basis just like Java's
    @argfiles or Python's argparse would handle it.
    Consider that jvm.config suffers from the same issue its parsing is not
    portable between Bourne shell and Windows Command prompt.
---
 .../src/main/java/org/apache/maven/cli/MavenCli.java  |  3 ++-
 .../test/java/org/apache/maven/cli/MavenCliTest.java  | 19 +++++++++++++++----
 .../src/test/projects/config/.mvn/maven.config        |  5 +++--
 .../projects/mavenConfigProperties/.mvn/maven.config  |  4 +++-
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 45fe047..07a9c78 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -104,6 +104,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -387,7 +388,7 @@ public class MavenCli
 
             if ( configFile.isFile() )
             {
-                for ( String arg : new String( Files.readAllBytes( configFile.toPath() ) ).split( "\\s+" ) )
+                for ( String arg : Files.readAllLines( configFile.toPath(), Charset.defaultCharset() ) )
                 {
                     if ( !arg.isEmpty() )
                     {
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
index 164b85a..4191e88 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
@@ -195,8 +195,10 @@ public class MavenCliTest
     /**
      * Read .mvn/maven.config with the following definitions:
      * <pre>
-     *   -T 3
+     *   -T
+     *   3
      *   -Drevision=1.3.0
+     *   "-Dlabel=Apache Maven"
      * </pre>
      * and check if the {@code -T 3} option can be overwritten via command line
      * argument.
@@ -221,8 +223,10 @@ public class MavenCliTest
     /**
      * Read .mvn/maven.config with the following definitions:
      * <pre>
-     *   -T 3
+     *   -T
+     *   3
      *   -Drevision=1.3.0
+     *   "-Dlabel=Apache Maven"
      * </pre>
      * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line
      * argument.
@@ -249,8 +253,10 @@ public class MavenCliTest
     /**
      * Read .mvn/maven.config with the following definitions:
      * <pre>
-     *   -T 3
+     *   -T
+     *   3
      *   -Drevision=1.3.0
+     *   "-Dlabel=Apache Maven"
      * </pre>
      * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line
      * argument.
@@ -277,8 +283,10 @@ public class MavenCliTest
     /**
      * Read .mvn/maven.config with the following definitions:
      * <pre>
-     *   -T 3
+     *   -T
+     *   3
      *   -Drevision=1.3.0
+     *   "-Dlabel=Apache Maven"
      * </pre>
      * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line argument when there are
      * funky arguments present.
@@ -300,11 +308,14 @@ public class MavenCliTest
         cli.cli( request );
         cli.properties( request );
 
+        assertEquals( "3", request.commandLine.getOptionValue( CLIManager.THREADS ) );
+
         String revision = System.getProperty( "revision" );
         assertEquals( "8.2.0", revision );
 
         assertEquals( "bar ", request.getSystemProperties().getProperty( "foo" ) );
         assertEquals( "bar two", request.getSystemProperties().getProperty( "foo2" ) );
+        assertEquals( "Apache Maven", request.getSystemProperties().getProperty( "label" ) );
 
         assertEquals( "-Dpom.xml", request.getCommandLine().getOptionValue( CLIManager.ALTERNATE_POM_FILE ) );
     }
diff --git a/maven-embedder/src/test/projects/config/.mvn/maven.config b/maven-embedder/src/test/projects/config/.mvn/maven.config
index 3d0f13b..280d577 100644
--- a/maven-embedder/src/test/projects/config/.mvn/maven.config
+++ b/maven-embedder/src/test/projects/config/.mvn/maven.config
@@ -1,2 +1,3 @@
--T8 --builder  
-  multithreaded
+-T8
+--builder
+multithreaded
diff --git a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
index c73de53..8257023 100644
--- a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
+++ b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
@@ -1,3 +1,5 @@
--T 3
+-T
+3
 -Drevision=1.3.0
+"-Dlabel=Apache Maven"