You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/13 15:29:12 UTC

[maven-jlink-plugin] branch MJLINK-6 created (now 93e6704)

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

rfscholte pushed a change to branch MJLINK-6
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git.


      at 93e6704  Remove useless 'return' statement from integration test.

This branch includes the following new commits:

     new 3e961d7  Add 'sourceJdkModules' configuration parameter.
     new 6ef1143  Clean up integration test. Set 'sourceJdkModules' parameter type to File.
     new 93e6704  Remove useless 'return' statement from integration test.

The 3 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-jlink-plugin] 01/03: Add 'sourceJdkModules' configuration parameter.

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

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

commit 3e961d777283be1e107eb591b4a6e1100a2678a8
Author: Andre Tadeu de Carvalho <an...@gmail.com>
AuthorDate: Thu Jan 3 23:15:39 2019 -0200

    Add 'sourceJdkModules' configuration parameter.
    
    This parameter allows to create a distributable Java custom runtime image without setting JAVA_HOME/Toolschain. This allows to create a Java custom runtime image from one Operating System to another.
---
 .../MJLINK-6_allowSetJmodPath/invoker.properties   | 18 +++++++
 src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml  | 59 ++++++++++++++++++++++
 .../src/main/java/com/corporate/project/Main.java  | 35 +++++++++++++
 .../src/main/java/module-info.java                 | 24 +++++++++
 .../MJLINK-6_allowSetJmodPath/verify.groovy        | 50 ++++++++++++++++++
 .../org/apache/maven/plugins/jlink/JLinkMojo.java  | 17 ++++++-
 6 files changed, 202 insertions(+), 1 deletion(-)

diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/invoker.properties b/src/it/projects/MJLINK-6_allowSetJmodPath/invoker.properties
new file mode 100644
index 0000000..8948d9b
--- /dev/null
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/invoker.properties
@@ -0,0 +1,18 @@
+# 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 package
diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml b/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
new file mode 100644
index 0000000..44b3163
--- /dev/null
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
@@ -0,0 +1,59 @@
+<?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/maven-v4_0_0.xsd"
+>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-jlink-plugin-mjlink-6</artifactId>
+  <version>96.0</version>
+  <packaging>jlink</packaging>
+  <name>Maven</name>
+  <url>https://maven.apache.org</url>
+  <description>Test JLink create a distributable JVM that is not currently used</description>
+  <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>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.0</version>
+        <configuration>
+          <source>1.9</source>
+          <target>1.9</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jlink-plugin</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <configuration>
+          <!-- <sourceJdkModules>/home/andre/Desktop/openjdk-11.0.1_windows-x64_bin/jdk-11.0.1</sourceJdkModules> -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/src/main/java/com/corporate/project/Main.java b/src/it/projects/MJLINK-6_allowSetJmodPath/src/main/java/com/corporate/project/Main.java
new file mode 100644
index 0000000..1b4ca36
--- /dev/null
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/src/main/java/com/corporate/project/Main.java
@@ -0,0 +1,35 @@
+package com.corporate.project;
+
+/*
+ * 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.
+ */
+
+public class Main
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Main one from Java 9+" );
+        if ( args.length > 0 )
+        {
+            for ( String arg : args )
+            {
+                System.out.println( " Arg: '" + arg + "'" );
+            }
+        }
+    }
+}
diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/src/main/java/module-info.java b/src/it/projects/MJLINK-6_allowSetJmodPath/src/main/java/module-info.java
new file mode 100644
index 0000000..d35441d
--- /dev/null
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/src/main/java/module-info.java
@@ -0,0 +1,24 @@
+
+/*
+ * 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.
+ */
+
+module com.corporate.project {
+  requires java.base;
+  exports com.corporate.project;
+}
diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
new file mode 100644
index 0000000..f03fb3d
--- /dev/null
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
@@ -0,0 +1,50 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or not a directory." );
+        return false;
+    }
+    File artifact = new File( target, "maven-jlink-plugin-mjlink-6-96.0.zip" );
+    if ( !artifact.exists() || artifact.isDirectory() )
+    {
+        System.err.println( "maven-jlink-plugin-mjlink-26-96.0.zip file is missing or is a directory." );
+        return false;
+    }
+
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;
diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index 86cb01a..a5f69fa 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -241,6 +242,12 @@ public class JLinkMojo
     private ZipArchiver zipArchiver;
 
     /**
+     * Set the JDK location to create a Java custom runtime image.
+     */
+    @Parameter
+    private String sourceJdkModules;
+
+    /**
      * Name of the generated ZIP file in the <code>target</code> directory. This will not change the name of the
      * installed/deployed file.
      */
@@ -260,7 +267,15 @@ public class JLinkMojo
 
         // Really Hacky...do we have a better solution to find the jmods directory of the JDK?
         File jLinkParent = jLinkExecuteable.getParentFile().getParentFile();
-        File jmodsFolder = new File( jLinkParent, JMODS );
+        File jmodsFolder;
+        if ( StringUtils.isNotBlank( sourceJdkModules ) )
+        {
+            jmodsFolder = new File ( sourceJdkModules, JMODS );
+        }
+        else
+        {
+            jmodsFolder = new File( jLinkParent, JMODS );
+        }
 
         getLog().debug( " Parent: " + jLinkParent.getAbsolutePath() );
         getLog().debug( " jmodsFolder: " + jmodsFolder.getAbsolutePath() );


[maven-jlink-plugin] 03/03: Remove useless 'return' statement from integration test.

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

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

commit 93e670417871d590736ce57cd97625198836aae7
Author: Andre Tadeu de Carvalho <an...@gmail.com>
AuthorDate: Fri Jan 11 17:15:09 2019 -0200

    Remove useless 'return' statement from integration test.
---
 src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
index dd8f904..a594432 100644
--- a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
@@ -27,6 +27,4 @@ File target = new File( basedir, "target" );
 assert target.isDirectory()
 
 File artifact = new File( target, "maven-jlink-plugin-mjlink-6-96.0.zip" );
-assert artifact.isFile()
-
-return true
+assert artifact.isFile()
\ No newline at end of file


[maven-jlink-plugin] 02/03: Clean up integration test. Set 'sourceJdkModules' parameter type to File.

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

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

commit 6ef114368e04f1de391403fa30be406db0bfaf4a
Author: Andre Tadeu de Carvalho <an...@gmail.com>
AuthorDate: Fri Jan 11 16:10:12 2019 -0200

    Clean up integration test. Set 'sourceJdkModules' parameter type to File.
---
 src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml  |  6 ++--
 .../MJLINK-6_allowSetJmodPath/verify.groovy        | 36 ++++++----------------
 .../org/apache/maven/plugins/jlink/JLinkMojo.java  |  5 ++-
 3 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml b/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
index 44b3163..8839569 100644
--- a/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/pom.xml
@@ -26,8 +26,8 @@
   <artifactId>maven-jlink-plugin-mjlink-6</artifactId>
   <version>96.0</version>
   <packaging>jlink</packaging>
-  <name>Maven</name>
-  <url>https://maven.apache.org</url>
+  <url>https://issues.apache.org/jira/browse/MJLINK-6</url>
+
   <description>Test JLink create a distributable JVM that is not currently used</description>
   <properties>
     <maven.compiler.source>1.9</maven.compiler.source>
@@ -51,7 +51,7 @@
         <version>@project.version@</version>
         <extensions>true</extensions>
         <configuration>
-          <!-- <sourceJdkModules>/home/andre/Desktop/openjdk-11.0.1_windows-x64_bin/jdk-11.0.1</sourceJdkModules> -->
+          <sourceJdkModules>${java.home}</sourceJdkModules>
         </configuration>
       </plugin>
     </plugins>
diff --git a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
index f03fb3d..dd8f904 100644
--- a/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
+++ b/src/it/projects/MJLINK-6_allowSetJmodPath/verify.groovy
@@ -18,33 +18,15 @@
  * under the License.
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import org.codehaus.plexus.util.*;
+import java.io.*
+import java.util.*
+import java.util.jar.*
+import org.codehaus.plexus.util.*
 
-boolean result = true;
+File target = new File( basedir, "target" );
+assert target.isDirectory()
 
-try
-{
-    File target = new File( basedir, "target" );
-    if ( !target.exists() || !target.isDirectory() )
-    {
-        System.err.println( "target file is missing or not a directory." );
-        return false;
-    }
-    File artifact = new File( target, "maven-jlink-plugin-mjlink-6-96.0.zip" );
-    if ( !artifact.exists() || artifact.isDirectory() )
-    {
-        System.err.println( "maven-jlink-plugin-mjlink-26-96.0.zip file is missing or is a directory." );
-        return false;
-    }
+File artifact = new File( target, "maven-jlink-plugin-mjlink-6-96.0.zip" );
+assert artifact.isFile()
 
-}
-catch( Throwable e )
-{
-    e.printStackTrace();
-    result = false;
-}
-
-return result;
+return true
diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
index a5f69fa..137c6b8 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -30,7 +30,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -245,7 +244,7 @@ public class JLinkMojo
      * Set the JDK location to create a Java custom runtime image.
      */
     @Parameter
-    private String sourceJdkModules;
+    private File sourceJdkModules;
 
     /**
      * Name of the generated ZIP file in the <code>target</code> directory. This will not change the name of the
@@ -268,7 +267,7 @@ public class JLinkMojo
         // Really Hacky...do we have a better solution to find the jmods directory of the JDK?
         File jLinkParent = jLinkExecuteable.getParentFile().getParentFile();
         File jmodsFolder;
-        if ( StringUtils.isNotBlank( sourceJdkModules ) )
+        if ( sourceJdkModules != null && sourceJdkModules.isDirectory() )
         {
             jmodsFolder = new File ( sourceJdkModules, JMODS );
         }