void (@NotNull CompileContext context) { LOG.info("jlink task was started"); JpsSdk<?> javaSdk = findValidSdk(context); if (javaSdk == null) { error(context, JpsBuildBundle.message("packaging.jlink.build.task.wrong.java.version")); return; } JpsJLinkProperties properties = (JpsJLinkProperties)myArtifact.getProperties(); String artifactOutputPath = myArtifact.getOutputPath(); if (artifactOutputPath == null) { error(context, JpsBuildBundle.message("packaging.jlink.build.task.unknown.artifact.path")); return; } Path runtimeImagePath = Paths.get(artifactOutputPath, IMAGE_DIR_NAME); List<String> commands = buildCommands(context, properties, javaSdk, artifactOutputPath, runtimeImagePath); if (commands.isEmpty()) return; try { FileUtil.delete(runtimeImagePath); } catch (IOException e) { error(context, JpsBuildBundle.message("packaging.jlink.build.task.run.time.image.deletion.failure")); return; } final int errorCode = startProcess(context, commands, properties); if (errorCode != 0) { error(context, JpsBuildBundle.message("packaging.jlink.build.task.failure")); return; } LOG.info("jlink task was finished"); }