[MJLINK-3] Improve verbose output during build.
authorAndre Tadeu de Carvalho <andre.t.carvalho@external.cardif.com.br>
Tue, 21 Aug 2018 20:31:06 +0000 (17:31 -0300)
committerKarl Heinz Marbaise <khmarbaise@apache.org>
Wed, 22 Aug 2018 09:18:48 +0000 (11:18 +0200)
src/it/projects/MJLINK-3_improveVerboseOutput/invoker.properties [new file with mode: 0644]
src/it/projects/MJLINK-3_improveVerboseOutput/pom.xml [new file with mode: 0644]
src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkMojo.java

diff --git a/src/it/projects/MJLINK-3_improveVerboseOutput/invoker.properties b/src/it/projects/MJLINK-3_improveVerboseOutput/invoker.properties
new file mode 100644 (file)
index 0000000..8b74b48
--- /dev/null
@@ -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 (file)
index 0000000..46e9d79
--- /dev/null
@@ -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
index 2a47e45..39e32ac 100644 (file)
@@ -159,10 +159,15 @@ public abstract class AbstractJLinkMojo
 \r
             if ( exitCode != 0 )\r
             {\r
+\r
                 if ( StringUtils.isNotEmpty( output ) )\r
                 {\r
                     // Reconsider to use WARN / ERROR ?\r
-                    getLog().error( output );\r
+                   //  getLog().error( output );\r
+                    for ( String outputLine : output.split( "\n" ) )\r
+                    {\r
+                        getLog().error( outputLine );\r
+                    }\r
                 }\r
 \r
                 StringBuilder msg = new StringBuilder( "\nExit code: " );\r
@@ -179,7 +184,11 @@ public abstract class AbstractJLinkMojo
 \r
             if ( StringUtils.isNotEmpty( output ) )\r
             {\r
-                getLog().info( output );\r
+                //getLog().info( output );\r
+                for ( String outputLine : output.split( "\n" ) )\r
+                {\r
+                    getLog().info( outputLine );\r
+                }\r
             }\r
         }\r
         catch ( CommandLineException e )\r