void (@NotNull Project project, @NotNull MavenRunner mavenRunner, @NotNull String title, @NotNull List<MavenRunnerParameters> commands, @NotNull ProjectTaskContext context, @Nullable ProjectTaskNotification callback) { ApplicationManager.getApplication().invokeAndWait(() -> { FileDocumentManager.getInstance().saveAllDocuments(); for (MavenRunnerParameters command : commands) { MavenRunConfigurationType.runConfiguration(project, command, null, null, descriptor -> { if(callback == null){ return; } ProcessHandler handler = descriptor.getProcessHandler(); if (handler != null) { handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { if (event.getExitCode() == 0) { callback.finished(new ProjectTaskResult(false, 0, 0)); } else { callback.finished(new ProjectTaskResult(true, 0, 0)); } } }); } }, true); } }); }