boolean (Module module, List<String> errorMessages, List<String> successMessages) { String pluginName = module.getName(); String defaultPath = new File(module.getModuleFilePath()).getParent() + File.separator + pluginName; Set<Module> modules = new HashSet<>(); PluginBuildUtil.getDependencies(module, modules); modules.add(module); Set<Library> libs = new HashSet<>(); for (Module dep : modules) { PluginBuildUtil.getLibraries(dep, libs); } Map<Module, String> jpsModules = collectJpsPluginModules(module); modules.removeAll(jpsModules.keySet()); boolean isZip = !libs.isEmpty() || !jpsModules.isEmpty(); String oldPath = defaultPath + (isZip ? JAR_EXTENSION : ZIP_EXTENSION); File oldFile = new File(oldPath); if (oldFile.exists()) { String message = DevKitBundle.message("suggest.to.delete", oldPath), title = DevKitBundle.message("info.message"); if (Messages.showYesNoDialog(module.getProject(), message, title, Messages.getInformationIcon()) == Messages.YES) { FileUtil.delete(oldFile); } } String dstPath = defaultPath + (isZip ? ZIP_EXTENSION : JAR_EXTENSION); File dstFile = new File(dstPath); return clearReadOnly(module.getProject(), dstFile) && ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator != null) { progressIndicator.setText(DevKitBundle.message("prepare.for.deployment.task.progress")); progressIndicator.setIndeterminate(true); } try { File jarFile = preparePluginsJar(module, modules); if (isZip) { try { processLibrariesAndJpsPlugins(jarFile, dstFile, pluginName, libs, jpsModules); } finally { FileUtil.delete(jarFile); } } else { FileUtil.rename(jarFile, dstFile); } LocalFileSystem.getInstance().refreshIoFiles(Collections.singleton(dstFile), true, false, null); successMessages.add(DevKitBundle.message("saved.message", isZip ? 1 : 2, pluginName, dstPath)); } catch (IOException e) { errorMessages.add(e.getMessage() + "\n(" + dstPath + ")"); } }, DevKitBundle.message("prepare.for.deployment.task", pluginName), true, module.getProject()); }