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/23 12:57:41 UTC
(maven-jlink-plugin) 02/02: [MJLINK-77] accept JDK21+ compress parameters, not validating contents
This is an automated email from the ASF dual-hosted git repository.
bmarwell pushed a commit to branch MJLINK-77_compress-parameters-jdk21-no-validation
in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
commit 9dede2f7c921c9fd63a6d4cb93e33b897e0b7f86
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 | 26 +++++++++++++++-------
1 file changed, 18 insertions(+), 8 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..2a2a77e 100644
--- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
@@ -106,9 +106,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 +525,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 +607,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
}
if (compress != null) {
jlinkArgs.add("--compress");
- jlinkArgs.add(compress + "");
+ jlinkArgs.add(compress);
}
if (launcher != null) {
jlinkArgs.add("--launcher");