2121 */
2222public class BundleJre extends ArtifactGenerator <Packager > {
2323
24+ private static final String ALL_MODULES = "ALL-MODULE-PATH" ;
25+
2426 public BundleJre () {
2527 super ("JRE" );
2628 }
@@ -135,7 +137,7 @@ protected File doApply(Packager packager) throws Exception {
135137 "--no-header-files" ,
136138 "--no-man-pages" ,
137139 "--strip-debug" ,
138- "--compress=2"
140+ ( VersionUtils . getJavaMajorVersion () < 21 ? "--compress=2" : null )
139141 );
140142
141143 // sets execution permissions on executables in jre
@@ -195,15 +197,19 @@ protected String getRequiredModules(File packagingJdk, File libsFolder, boolean
195197
196198 List <String > modulesList ;
197199
198- if (customizedJre && defaultModules != null && !defaultModules .isEmpty ()) {
200+ if (!customizedJre ) {
201+
202+ return ALL_MODULES ;
203+
204+ } else if (defaultModules != null && !defaultModules .isEmpty ()) {
199205
200206 modulesList =
201207 defaultModules
202208 .stream ()
203209 .map (module -> module .trim ())
204210 .collect (Collectors .toList ());
205211
206- } else if (customizedJre && VersionUtils .getJavaMajorVersion () >= 13 ) {
212+ } else if (VersionUtils .getJavaMajorVersion () >= 13 ) {
207213
208214 String modules =
209215 CommandUtils .execute (
@@ -224,7 +230,7 @@ protected String getRequiredModules(File packagingJdk, File libsFolder, boolean
224230 .filter (module -> !module .isEmpty ())
225231 .collect (Collectors .toList ());
226232
227- } else if (customizedJre && VersionUtils .getJavaMajorVersion () >= 9 ) {
233+ } else if (VersionUtils .getJavaMajorVersion () >= 9 ) {
228234
229235 String modules =
230236 CommandUtils .execute (
@@ -256,7 +262,7 @@ protected String getRequiredModules(File packagingJdk, File libsFolder, boolean
256262
257263 if (modulesList .isEmpty ()) {
258264 Logger .warn ("It was not possible to determine the necessary modules. All modules will be included" );
259- modulesList .add ("ALL-MODULE-PATH" );
265+ modulesList .add (ALL_MODULES );
260266 } else {
261267 modulesList .addAll (additionalModules );
262268 }
0 commit comments