void (final MavenRunnerParameters parameters, final MavenRunnerSettings settings, final Runnable onComplete) { ApplicationManager.getApplication().invokeAndWait(() -> FileDocumentManager.getInstance().saveAllDocuments()); ProgramRunner.Callback callback = descriptor -> { ProcessHandler handler = descriptor.getProcessHandler(); if (handler == null) return; handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { if (event.getExitCode() == 0 && onComplete != null) { onComplete.run(); } } }); }; MavenRunConfigurationType.runConfiguration(myProject, parameters, null, settings, callback, false); }