You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/12/14 23:48:38 UTC

[maven-jlink-plugin] branch MJLINK-41_launcherargs updated (e4c7b99 -> 84f5382)

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

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


 discard e4c7b99  [MJLINK-41] add support for --add-options argument (JDK14+).
     add 94fa639  Revert "jdk8 with buildchain"
     add a1bda61  Prepare to planned change to default Ubuntu version for Github Actions https://github.com/actions/virtual-environments/issues/1816
     add f8bdf50  Java 9+ ToolProvider via multi-release jar.
     add 24f2bf8  [MJLINK-58] Remove usage of plexus utils, use commons lang or native java instead.
     add 7ed7e03  Toolchain JDK is now available for windows.
     add 209282f  [MJLINK-52] Add classifier support
     add 244ce72  Bump mockito-core from 3.5.13 to 3.6.28
     new 84f5382  [MJLINK-41] add support for --add-options argument (JDK14+).

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   (e4c7b99)
            \
             N -- N -- N   refs/heads/MJLINK-41_launcherargs (84f5382)

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:
 .github/workflows/maven.yml                        |  52 ++---
 .gitignore                                         |   2 -
 pom.xml                                            |  54 ++++-
 .../invoker.properties                             |   3 +-
 .../pom.xml                                        |  28 ++-
 .../verify.groovy                                  |   8 +-
 .../invoker.properties                             |   3 +-
 .../pom.xml                                        |  28 ++-
 .../verify.groovy                                  |   8 +-
 .../MJLINK-40_includeLocales/verify.groovy         |  16 +-
 .../invoker.properties                             |   0
 .../{MJLINK-26 => MJLINK-52_classifiers}/pom.xml   |  14 +-
 .../src/main/java/com/corporate/project/Main.java  |   0
 .../src/main/java/module-info.java                 |   0
 .../verify.groovy                                  |  22 +-
 .../invoker.properties                             |   0
 .../pom.xml                                        |  35 ++-
 .../src/main/java/com/corporate/project/Main.java  |   0
 .../src/main/java/module-info.java                 |   0
 .../verify.groovy                                  |  11 +-
 .../invoker.properties                             |   1 +
 .../pom.xml                                        |  24 +-
 .../src/main/java/com/corporate/project/Main.java  |   0
 .../src/main/java/module-info.java                 |   0
 .../verify.groovy                                  |  11 +-
 .../invoker.properties                             |   0
 .../pom.xml                                        |  25 ++-
 .../src/main/java/com/corporate/project/Main.java  |   0
 .../src/main/java/module-info.java                 |   0
 .../verify.groovy                                  |  35 +--
 .../maven/plugins/jlink/AbstractJLinkExecutor.java |  63 ++++++
 .../maven/plugins/jlink/AbstractJLinkMojo.java     | 160 ++------------
 .../jlink/AbstractJLinkToolchainExecutor.java      | 204 +++++++++++++++++
 .../apache/maven/plugins/jlink/JLinkExecutor.java} |  24 +-
 .../org/apache/maven/plugins/jlink/JLinkMojo.java  | 245 ++++++++++++---------
 .../apache/maven/plugins/jlink/JLinkExecutor.java  | 143 ++++++++++++
 36 files changed, 807 insertions(+), 412 deletions(-)
 copy src/it/projects/{MJLINK-40_includeLocales => MJLINK-36_toolchainjdk8}/invoker.properties (92%)
 copy src/it/projects/{MJLINK-40_includeLocales => MJLINK-36_toolchainjdk8}/pom.xml (81%)
 copy src/it/projects/{cli-options/add-options => MJLINK-36_toolchainjdk8}/verify.groovy (83%)
 copy src/it/projects/{MJLINK-40_includeLocales => MJLINK-36_toolchainjdk9}/invoker.properties (93%)
 copy src/it/projects/{MJLINK-40_includeLocales => MJLINK-36_toolchainjdk9}/pom.xml (81%)
 copy src/it/projects/{cli-options/add-options => MJLINK-36_toolchainjdk9}/verify.groovy (83%)
 copy src/it/projects/{cli-options/suggest-providers => MJLINK-52_classifiers}/invoker.properties (100%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers}/pom.xml (85%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers}/src/main/java/com/corporate/project/Main.java (100%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers}/src/main/java/module-info.java (100%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers}/verify.groovy (79%)
 copy src/it/projects/{cli-options/suggest-providers => MJLINK-52_classifiers_duplicate_classifier}/invoker.properties (100%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers_duplicate_classifier}/pom.xml (67%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers_duplicate_classifier}/src/main/java/com/corporate/project/Main.java (100%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers_duplicate_classifier}/src/main/java/module-info.java (100%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers_duplicate_classifier}/verify.groovy (87%)
 copy src/it/projects/{MJLINK-9_reactor => MJLINK-52_classifiers_duplicate_default}/invoker.properties (96%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers_duplicate_default}/pom.xml (74%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers_duplicate_default}/src/main/java/com/corporate/project/Main.java (100%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers_duplicate_default}/src/main/java/module-info.java (100%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers_duplicate_default}/verify.groovy (90%)
 copy src/it/projects/{cli-options/suggest-providers => MJLINK-52_classifiers_jarproject}/invoker.properties (100%)
 copy src/it/projects/{MJLINK-26 => MJLINK-52_classifiers_jarproject}/pom.xml (74%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers_jarproject}/src/main/java/com/corporate/project/Main.java (100%)
 copy src/it/projects/{MJLINK-6_allowSetJmodPath => MJLINK-52_classifiers_jarproject}/src/main/java/module-info.java (100%)
 copy src/it/projects/{MJLINK-40_includeLocales => MJLINK-52_classifiers_jarproject}/verify.groovy (60%)
 create mode 100644 src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkExecutor.java
 create mode 100644 src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java
 copy src/{it/projects/MJLINK-6_allowSetJmodPath/src/main/java/com/corporate/project/Main.java => main/java/org/apache/maven/plugins/jlink/JLinkExecutor.java} (68%)
 create mode 100644 src/main/java9/org/apache/maven/plugins/jlink/JLinkExecutor.java


[maven-jlink-plugin] 01/01: [MJLINK-41] add support for --add-options argument (JDK14+).

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

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

commit 84f538245bc685b3f0a2fd244ae02f96e55afcf8
Author: Benjamin Marwell <bm...@apache.org>
AuthorDate: Thu Nov 12 17:54:16 2020 +0100

    [MJLINK-41] add support for --add-options argument (JDK14+).
---
 .../cli-options/add-options/invoker.properties     | 19 +++++++
 src/it/projects/cli-options/add-options/pom.xml    | 65 ++++++++++++++++++++++
 .../add-options/src/main/configs/config.test       | 21 +++++++
 .../projects/cli-options/add-options/verify.groovy | 34 +++++++++++
 .../org/apache/maven/plugins/jlink/JLinkMojo.java  | 27 +++++++++
 5 files changed, 166 insertions(+)

diff --git a/src/it/projects/cli-options/add-options/invoker.properties b/src/it/projects/cli-options/add-options/invoker.properties
new file mode 100644
index 0000000..03b85d3
--- /dev/null
+++ b/src/it/projects/cli-options/add-options/invoker.properties
@@ -0,0 +1,19 @@
+# suppress inspection "UnusedProperty" for whole file
+# 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 = 14+
+invoker.goals = clean package
diff --git a/src/it/projects/cli-options/add-options/pom.xml b/src/it/projects/cli-options/add-options/pom.xml
new file mode 100644
index 0000000..84d6851
--- /dev/null
+++ b/src/it/projects/cli-options/add-options/pom.xml
@@ -0,0 +1,65 @@
+<?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-cli-options-add-options</artifactId>
+  <version>101.0</version>
+  <packaging>jlink</packaging>
+  <name>Maven</name>
+  <url>http://maven.apache.org</url>
+  <description>Test JLink CLI Options --add-options.</description>
+  <properties>
+    <maven.compiler.release>14</maven.compiler.release>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>localhost</groupId>
+      <artifactId>first-jar-module-info</artifactId>
+      <version>99.0</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.8.0</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jlink-plugin</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <configuration>
+          <addOptions>
+            <addOption>-Xmx128m</addOption>
+            <addOption>--enable-preview</addOption>
+            <addOption>-Dvar=value</addOption>
+          </addOptions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/projects/cli-options/add-options/src/main/configs/config.test b/src/it/projects/cli-options/add-options/src/main/configs/config.test
new file mode 100644
index 0000000..405149a
--- /dev/null
+++ b/src/it/projects/cli-options/add-options/src/main/configs/config.test
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+Test configuration file which should be located in config/config.test in
+resulting jmod file.
\ No newline at end of file
diff --git a/src/it/projects/cli-options/add-options/verify.groovy b/src/it/projects/cli-options/add-options/verify.groovy
new file mode 100644
index 0000000..32e21da
--- /dev/null
+++ b/src/it/projects/cli-options/add-options/verify.groovy
@@ -0,0 +1,34 @@
+
+/*
+ * 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.*
+
+File target = new File( basedir, "target" )
+assert target.isDirectory()
+
+File artifact = new File( target, "maven-jlink-plugin-cli-options-add-options-101.0.zip" )
+assert artifact.isFile()
+
+File jlinkArgs = new File( target, "jlinkArgs" )
+assert jlinkArgs.isFile()
+
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 f8ff013..af00fc2 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -101,6 +101,27 @@ public class JLinkMojo
     private String launcher;
 
     /**
+     * These JVM arguments will be appended to the {@code lib/modules} file.<br>
+     * <strong>This parameter requires at least JDK 14.<br></strong>
+     *
+     * <p>The command line equivalent is: {@code jlink --add-options="…"}.</p>
+     *
+     * <p>Example:</p>
+     *
+     * <pre>
+     *   &lt;addOptions&gt;
+     *     &lt;addOption&gt;-Xmx256m&lt;/addOption&gt;
+     *     &lt;addOption&gt;--enable-preview&lt;/addOption&gt;
+     *     &lt;addOption&gt;-Dvar=value&lt;/addOption&gt;
+     *   &lt;/addOptions&gt;
+     * </pre>
+     *
+     * <p>Above example will result in {@code jlink --add-options="-Xmx256m" --enable-preview -Dvar=value"}.</p>
+     */
+    @Parameter
+    private List<String> addOptions;
+
+    /**
      * Limit the universe of observable modules. The following gives an example of the configuration which can be used
      * in the <code>pom.xml</code> file.
      * 
@@ -601,6 +622,12 @@ public class JLinkMojo
             jlinkArgs.add( "--launcher" );
             jlinkArgs.add( launcher );
         }
+        if ( addOptions != null )
+        {
+            // needs JDK 14+
+            argsFile.println( "--add-options" );
+            argsFile.printf( "\"%s\"%n", String.join( " ", addOptions ) );
+        }
 
         if ( disablePlugin != null )
         {