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 34487a3f..2a2a77ef 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:
* -c, --compress=level>
. The valid values for the level are: 0, 1, 2
.
+ * -c, --compress=<level>
.
+ *
+ *
The valid values for the level depend on the JDK:
+ *
+ * For JDK 9+:
+ *
+ * - 0: No compression. Equivalent to zip-0.
+ * - 1: Constant String Sharing
+ * - 2: Equivalent to zip-6.
+ *
+ *
+ * For JDK 21+, those values are deprecated and to be removed in a future version.
+ * The supported values are:
+ * {@code zip-[0-9]}, where {@code zip-0} provides no compression,
+ * and {@code zip-9} provides the best compression.
+ * Default is {@code zip-6}.
*/
@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 @@ private File createZipArchiveFromImage(File outputDirectory, File outputDirector
}
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 @@ protected List createJlinkArgs(Collection pathsOfModules, Collec
}
if (compress != null) {
jlinkArgs.add("--compress");
- jlinkArgs.add(compress + "");
+ jlinkArgs.add(compress);
}
if (launcher != null) {
jlinkArgs.add("--launcher");