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/06/30 20:00:53 UTC

[maven] branch 3.8.x/jansi-and-stuff created (now 3925486)

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

michaelo pushed a change to branch 3.8.x/jansi-and-stuff
in repository https://gitbox.apache.org/repos/asf/maven.git.


      at 3925486  [MNG-7032] Evaluate --help and --version after configuring the logging/color

This branch includes the following new commits:

     new bfd7c49  [MNG-7179] Upgrade Jansi to 2.3.3
     new 14ff5dd  [MNG-7177] Upgrade Maven Shared Utils to 3.3.4
     new 73f34c0  [MNG-7172] Remove expansion of Jansi native libraries
     new 3925486  [MNG-7032] Evaluate --help and --version after configuring the logging/color

The 4 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] 04/04: [MNG-7032] Evaluate --help and --version after configuring the logging/color

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

michaelo pushed a commit to branch 3.8.x/jansi-and-stuff
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 39254860d60f0165cd691e6ce269a6377e7b7f3c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Jan 21 17:13:40 2021 +0100

    [MNG-7032] Evaluate --help and --version after configuring the logging/color
---
 .../main/java/org/apache/maven/cli/MavenCli.java   |  8 ++++-
 .../java/org/apache/maven/cli/MavenCliTest.java    | 37 ++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

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 7d17e18..9c7c4d2 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
@@ -166,6 +166,8 @@ public class MavenCli
 
     private Map<String, ConfigurationProcessor> configurationProcessors;
 
+    private CLIManager cliManager;
+
     public MavenCli()
     {
         this( null );
@@ -278,6 +280,7 @@ public class MavenCli
             cli( cliRequest );
             properties( cliRequest );
             logging( cliRequest );
+            informativeCommands( cliRequest );
             version( cliRequest );
             localContainer = container( cliRequest );
             commands( cliRequest );
@@ -367,7 +370,7 @@ public class MavenCli
         //
         slf4jLogger = new Slf4jStdoutLogger();
 
-        CLIManager cliManager = new CLIManager();
+        cliManager = new CLIManager();
 
         List<String> args = new ArrayList<>();
         CommandLine mavenConfig = null;
@@ -417,7 +420,10 @@ public class MavenCli
             cliManager.displayHelp( System.out );
             throw e;
         }
+    }
 
+    private void informativeCommands( CliRequest cliRequest ) throws ExitException
+    {
         if ( cliRequest.commandLine.hasOption( CLIManager.HELP ) )
         {
             cliManager.displayHelp( System.out );
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 5f4c5b6..9889fbc 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
@@ -29,7 +29,12 @@ import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 
+import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.commons.cli.ParseException;
 import org.apache.maven.Maven;
@@ -331,4 +336,36 @@ public class MavenCliTest
         orderdEventSpyDispatcherMock.verify(eventSpyDispatcherMock, times(1)).onEvent(any(ToolchainsBuildingResult.class));
     }
 
+    /**
+     * MNG-7032: Disable colours for {@code --version} if {@code --batch-mode} is also given.
+     * @throws Exception cli invocation.
+     */
+    @Test
+    public void testVersionStringWithoutAnsi() throws Exception
+    {
+        // given
+        // - request with version and batch mode
+        CliRequest cliRequest = new CliRequest( new String[] {
+                "--version",
+                "--batch-mode"
+        }, null );
+        ByteArrayOutputStream systemOut = new ByteArrayOutputStream();
+        PrintStream oldOut = System.out;
+        System.setOut( new PrintStream( systemOut ) );
+
+        // when
+        try {
+            cli.cli( cliRequest );
+        } catch ( MavenCli.ExitException exitException ) {
+            // expected
+        } finally {
+            // restore sysout
+            System.setOut( oldOut );
+        }
+        String versionOut = new String( systemOut.toByteArray(), StandardCharsets.UTF_8 );
+
+        // then
+        assertEquals( MessageUtils.stripAnsiCodes( versionOut ), versionOut );
+    }
+
 }

[maven] 03/04: [MNG-7172] Remove expansion of Jansi native libraries

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

michaelo pushed a commit to branch 3.8.x/jansi-and-stuff
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 73f34c00d16c24edb0e5f9d7eb63bc0c730a72d1
Author: rfscholte <rf...@apache.org>
AuthorDate: Thu Jun 24 19:24:54 2021 +0200

    [MNG-7172] Remove expansion of Jansi native libraries
---
 apache-maven/pom.xml                         | 16 ----------------
 apache-maven/src/bin/mvn                     |  1 -
 apache-maven/src/bin/mvn.cmd                 |  1 -
 apache-maven/src/lib/jansi-native/README.txt |  7 -------
 apache-maven/src/main/assembly/component.xml |  8 --------
 5 files changed, 33 deletions(-)

diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index b0df64a..b6b86ae 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -133,22 +133,6 @@ under the License.
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <includeArtifactIds>jansi</includeArtifactIds>
-          <includes>META-INF/native/**</includes>
-        </configuration>
-        <executions>
-          <execution>
-            <id>unpack-jansi-native</id>
-            <goals>
-              <goal>unpack-dependencies</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <executions>
           <execution>
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index a554c66..1d42930 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -194,6 +194,5 @@ exec "$JAVACMD" \
   -classpath "${CLASSWORLDS_JAR}" \
   "-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
   "-Dmaven.home=${MAVEN_HOME}" \
-  "-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
   "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
   ${CLASSWORLDS_LAUNCHER} "$@"
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
index 50dafc7..b8367f6 100644
--- a/apache-maven/src/bin/mvn.cmd
+++ b/apache-maven/src/bin/mvn.cmd
@@ -175,7 +175,6 @@ set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
   -classpath %CLASSWORLDS_JAR% ^
   "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^
   "-Dmaven.home=%MAVEN_HOME%" ^
-  "-Dlibrary.jansi.path=%MAVEN_HOME%\lib\jansi-native" ^
   "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
   %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
 if ERRORLEVEL 1 goto error
diff --git a/apache-maven/src/lib/jansi-native/README.txt b/apache-maven/src/lib/jansi-native/README.txt
deleted file mode 100644
index 22857a6..0000000
--- a/apache-maven/src/lib/jansi-native/README.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-This directory contains Jansi native libraries, extracted from Jansi jar.
-
-You can add your own extensions for platforms not natively supported by
-Jansi: the libraries follow HawtJNI directory and filename conventions.
-See http://fusesource.github.io/hawtjni/documentation/api/org/fusesource/hawtjni/runtime/Library.html
-
-See https://github.com/fusesource/jansi-native for native lib source.
diff --git a/apache-maven/src/main/assembly/component.xml b/apache-maven/src/main/assembly/component.xml
index fab2c55..4f9ff16 100644
--- a/apache-maven/src/main/assembly/component.xml
+++ b/apache-maven/src/main/assembly/component.xml
@@ -63,14 +63,6 @@ under the License.
       </includes>
     </fileSet>
     <fileSet>
-      <directory>target/dependency/META-INF/native</directory>
-      <outputDirectory>lib/jansi-native</outputDirectory>
-      <includes>
-        <include>**</include>
-      </includes>
-      <fileMode>0755</fileMode>
-    </fileSet>
-    <fileSet>
       <directory>src/bin</directory>
       <outputDirectory>bin</outputDirectory>
       <includes>

[maven] 02/04: [MNG-7177] Upgrade Maven Shared Utils to 3.3.4

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

michaelo pushed a commit to branch 3.8.x/jansi-and-stuff
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 14ff5dd0dad46169ae2439253ab00e01bca8584c
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed Jun 30 21:11:51 2021 +0200

    [MNG-7177] Upgrade Maven Shared Utils to 3.3.4
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 068e74f..dcdd856 100644
--- a/pom.xml
+++ b/pom.xml
@@ -289,7 +289,7 @@ under the License.
       <dependency>
         <groupId>org.apache.maven.shared</groupId>
         <artifactId>maven-shared-utils</artifactId>
-        <version>3.2.1</version>
+        <version>3.3.4</version>
       </dependency>
       <dependency>
         <groupId>org.fusesource.jansi</groupId>

[maven] 01/04: [MNG-7179] Upgrade Jansi to 2.3.3

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

michaelo pushed a commit to branch 3.8.x/jansi-and-stuff
in repository https://gitbox.apache.org/repos/asf/maven.git

commit bfd7c491b86dfd26480fc6bb1b95df6dbea20945
Author: rfscholte <rf...@apache.org>
AuthorDate: Sat Jun 12 11:00:52 2021 +0200

    [MNG-7179] Upgrade Jansi to 2.3.3
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index bf185ba..068e74f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -294,7 +294,7 @@ under the License.
       <dependency>
         <groupId>org.fusesource.jansi</groupId>
         <artifactId>jansi</artifactId>
-        <version>1.17.1</version>
+        <version>2.3.3</version>
       </dependency>
       <dependency>
         <groupId>org.slf4j</groupId>