You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bm...@apache.org on 2023/12/24 12:39:51 UTC
(maven-jlink-plugin) branch master updated (e74bc0d -> f062f9b)
This is an automated email from the ASF dual-hosted git repository.
bmarwell pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
from e74bc0d Bump org.apache.maven.plugins:maven-project-info-reports-plugin
new e7090d1 [MJLINK-77] add JDK21+ zip-1 test
new f062f9b [MJLINK-77] accept JDK21+ compress parameters, not validating contents
The 2 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:
.../invoker.properties | 2 +-
.../pom.xml | 13 +++++++----
.../src/main/java/com/corporate/project/Main.java | 0
.../src/main/java/module-info.java | 0
.../verify.groovy | 16 +++++++++++--
.../org/apache/maven/plugins/jlink/JLinkMojo.java | 27 ++++++++++++++--------
6 files changed, 41 insertions(+), 17 deletions(-)
copy src/it/projects/{MJLINK-26 => MJLINK-77_compress-parameters}/invoker.properties (96%)
copy src/it/projects/{MJLINK-52_classifiers => MJLINK-77_compress-parameters}/pom.xml (84%)
copy src/it/projects/{MJLINK-26 => MJLINK-77_compress-parameters}/src/main/java/com/corporate/project/Main.java (100%)
copy src/it/projects/{MJLINK-26 => MJLINK-77_compress-parameters}/src/main/java/module-info.java (100%)
copy src/it/projects/{MJLINK-26 => MJLINK-77_compress-parameters}/verify.groovy (78%)
(maven-jlink-plugin) 01/02: [MJLINK-77] add JDK21+ zip-1 test
Posted by bm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bmarwell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
commit e7090d1ca2f962fc9cf1e19578b3ab12c1917e17
Author: Benjamin Marwell <bm...@apache.org>
AuthorDate: Fri Dec 22 22:18:11 2023 +0100
[MJLINK-77] add JDK21+ zip-1 test
---
.../invoker.properties | 18 +++++++
.../projects/MJLINK-77_compress-parameters/pom.xml | 57 ++++++++++++++++++++
.../src/main/java/com/corporate/project/Main.java | 35 ++++++++++++
.../src/main/java/module-info.java | 24 +++++++++
.../MJLINK-77_compress-parameters/verify.groovy | 62 ++++++++++++++++++++++
5 files changed, 196 insertions(+)
diff --git a/src/it/projects/MJLINK-77_compress-parameters/invoker.properties b/src/it/projects/MJLINK-77_compress-parameters/invoker.properties
new file mode 100644
index 0000000..259cff9
--- /dev/null
+++ b/src/it/projects/MJLINK-77_compress-parameters/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 = 21+
+invoker.goals = clean package
diff --git a/src/it/projects/MJLINK-77_compress-parameters/pom.xml b/src/it/projects/MJLINK-77_compress-parameters/pom.xml
new file mode 100644
index 0000000..43e39a1
--- /dev/null
+++ b/src/it/projects/MJLINK-77_compress-parameters/pom.xml
@@ -0,0 +1,57 @@
+<?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-77</artifactId>
+ <version>96.0</version>
+ <packaging>jlink</packaging>
+ <name>Maven</name>
+ <url>https://maven.apache.org</url>
+ <description>Test JLink JDK21+ compress parameter.</description>
+ <properties>
+ <maven.compiler.release>21</maven.compiler.release>
+ <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.12.0</version>
+ <configuration>
+ <release>21</release>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jlink-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <compress>zip-1</compress>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MJLINK-77_compress-parameters/src/main/java/com/corporate/project/Main.java b/src/it/projects/MJLINK-77_compress-parameters/src/main/java/com/corporate/project/Main.java
new file mode 100644
index 0000000..1b4ca36
--- /dev/null
+++ b/src/it/projects/MJLINK-77_compress-parameters/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-77_compress-parameters/src/main/java/module-info.java b/src/it/projects/MJLINK-77_compress-parameters/src/main/java/module-info.java
new file mode 100644
index 0000000..d35441d
--- /dev/null
+++ b/src/it/projects/MJLINK-77_compress-parameters/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-77_compress-parameters/verify.groovy b/src/it/projects/MJLINK-77_compress-parameters/verify.groovy
new file mode 100644
index 0000000..ae5a5d5
--- /dev/null
+++ b/src/it/projects/MJLINK-77_compress-parameters/verify.groovy
@@ -0,0 +1,62 @@
+
+/*
+ * 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-77-96.0.zip" );
+ if ( !artifact.exists() || artifact.isDirectory() )
+ {
+ System.err.println( "maven-jlink-plugin-mjlink-77-96.0.zip file is missing or is a directory." );
+ return false;
+ }
+
+ def buildLog = new File(basedir, "build.log")
+ def found = false
+ buildLog.eachLine{line ->
+ if (line.contains("--compress, zip-1")) {
+ found = true
+ }
+ }
+ if (!found) {
+ System.err.println( "Not found in build.log: '--compress, zip-1'." )
+ return false
+ }
+
+}
+catch( Throwable e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
(maven-jlink-plugin) 02/02: [MJLINK-77] accept JDK21+ compress parameters, not validating contents
Posted by bm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bmarwell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
commit f062f9bd49d3cf5ca51ad8cc5d51db9deec4caa3
Author: Benjamin Marwell <bm...@apache.org>
AuthorDate: Sat Dec 23 13:57:32 2023 +0100
[MJLINK-77] accept JDK21+ compress parameters, not validating contents
---
.../org/apache/maven/plugins/jlink/JLinkMojo.java | 27 ++++++++++++++--------
1 file changed, 18 insertions(+), 9 deletions(-)
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 34487a3..c9b135f 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -105,10 +105,25 @@ public class JLinkMojo extends AbstractJLinkMojo {
/**
* Here you can define the compression of the resources being used. The command line equivalent is:
- * <code>-c, --compress=level></code>. The valid values for the level are: <code>0, 1, 2</code>.
+ * <code>-c, --compress=<level></code>.
+ *
+ * <p>The valid values for the level depend on the JDK:</p>
+ *
+ * <p>For JDK 9+:</p>
+ * <ul>
+ * <li>0: No compression. Equivalent to zip-0.</li>
+ * <li>1: Constant String Sharing</li>
+ * <li>2: Equivalent to zip-6.</li>
+ * </ul>
+ *
+ * <p>For JDK 21+, those values are deprecated and to be removed in a future version.
+ * The supported values are:<br>
+ * {@code zip-[0-9]}, where {@code zip-0} provides no compression,
+ * and {@code zip-9} provides the best compression.<br>
+ * Default is {@code zip-6}.</p>
*/
@Parameter
- private Integer compress;
+ private String compress;
/**
* Should the plugin generate a launcher script by means of jlink? The command line equivalent is:
@@ -509,12 +524,6 @@ public class JLinkMojo extends AbstractJLinkMojo {
}
private void failIfParametersAreNotInTheirValidValueRanges() throws MojoFailureException {
- if (compress != null && (compress < 0 || compress > 2)) {
- String message = "The given compress parameters " + compress + " is not in the valid value range from 0..2";
- getLog().error(message);
- throw new MojoFailureException(message);
- }
-
if (endian != null && (!"big".equals(endian) && !"little".equals(endian))) {
String message = "The given endian parameter " + endian
+ " does not contain one of the following values: 'little' or 'big'.";
@@ -597,7 +606,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
}
if (compress != null) {
jlinkArgs.add("--compress");
- jlinkArgs.add(compress + "");
+ jlinkArgs.add(compress);
}
if (launcher != null) {
jlinkArgs.add("--launcher");