List<String> (@NotNull CompileContext context, @NotNull JpsJLinkProperties properties, @NotNull JpsSdk<?> javaSdk, @NotNull String artifactOutputPath, @NotNull Path runtimeImagePath) { String modulesSequence = getModulesSequence(artifactOutputPath); if (StringUtil.isEmpty(modulesSequence)) { error(context, JpsBuildBundle.message("packaging.jlink.build.task.modules.not.found")); return Collections.emptyList(); } String sdkHomePath = javaSdk.getHomePath(); String jLinkPath = Paths.get(sdkHomePath, "bin", "jlink").toString(); List<String> commands = new ArrayList<>(); commands.add(jLinkPath); if (properties.compressionLevel != null && properties.compressionLevel.hasCompression()) { addOption(commands, "--compress", String.valueOf(properties.compressionLevel.myValue)); } if (properties.verbose) { commands.add("--verbose"); } commands.add("--module-path"); commands.add(String.join(File.pathSeparator, artifactOutputPath, Paths.get(sdkHomePath, "jmods").toString())); commands.add("--add-modules"); commands.add(modulesSequence); addOption(commands, "--output", runtimeImagePath.toString()); LOG.info(String.join(" ", commands)); return commands; }