You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/08/22 09:09:41 UTC

[maven-jlink-plugin] 02/02: [MJLINK-3] Improve verbose output during build.

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

khmarbaise pushed a commit to branch MJLINK-3
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git

commit dae2c8a835ba43c9d74be6a1d88be8e0dd2ec3ca
Author: Andre Tadeu de Carvalho <an...@external.cardif.com.br>
AuthorDate: Tue Aug 21 17:31:06 2018 -0300

    [MJLINK-3] Improve verbose output during build.
---
 .../invoker.properties                             | 19 ++++++
 .../projects/MJLINK-3_improveVerboseOutput/pom.xml | 75 ++++++++++++++++++++++
 .../maven/plugins/jlink/AbstractJLinkMojo.java     | 13 +++-
 3 files changed, 105 insertions(+), 2 deletions(-)

diff --git a/src/it/projects/MJLINK-3_improveVerboseOutput/invoker.properties b/src/it/projects/MJLINK-3_improveVerboseOutput/invoker.properties
new file mode 100644
index 0000000..8b74b48
--- /dev/null
+++ b/src/it/projects/MJLINK-3_improveVerboseOutput/invoker.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.java.version = 1.9+
+invoker.goals = clean install
\ No newline at end of file
diff --git a/src/it/projects/MJLINK-3_improveVerboseOutput/pom.xml b/src/it/projects/MJLINK-3_improveVerboseOutput/pom.xml
new file mode 100644
index 0000000..46e9d79
--- /dev/null
+++ b/src/it/projects/MJLINK-3_improveVerboseOutput/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.jlink.its</groupId>
+  <artifactId>mjlink3</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>jlink</packaging>
+
+  <properties>
+    <maven.compiler.source>1.9</maven.compiler.source>
+    <maven.compiler.target>1.9</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <!-- use a dependency with a module-info.class -->
+      <artifactId>asm</artifactId>
+      <groupId>org.ow2.asm</groupId>
+      <version>6.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jlink-plugin</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <configuration>
+          <noHeaderFiles>true</noHeaderFiles>
+          <noManPages>true</noManPages>
+          <verbose>true</verbose>
+        </configuration>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.7.0</version>
+          <configuration>
+            <source>${maven.compiler.source}</source>
+            <target>${maven.compiler.target}</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
index 2a47e45..39e32ac 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java
@@ -159,10 +159,15 @@ public abstract class AbstractJLinkMojo
 
             if ( exitCode != 0 )
             {
+
                 if ( StringUtils.isNotEmpty( output ) )
                 {
                     // Reconsider to use WARN / ERROR ?
-                    getLog().error( output );
+                   //  getLog().error( output );
+                    for ( String outputLine : output.split( "\n" ) )
+                    {
+                        getLog().error( outputLine );
+                    }
                 }
 
                 StringBuilder msg = new StringBuilder( "\nExit code: " );
@@ -179,7 +184,11 @@ public abstract class AbstractJLinkMojo
 
             if ( StringUtils.isNotEmpty( output ) )
             {
-                getLog().info( output );
+                //getLog().info( output );
+                for ( String outputLine : output.split( "\n" ) )
+                {
+                    getLog().info( outputLine );
+                }
             }
         }
         catch ( CommandLineException e )