void () { ProgressIndicator indicator = new EmptyProgressIndicator(); String dirForLogs = myMultimoduleDirectories.iterator().next(); MavenLog.LOG.debug("Connecting maven connector in " + dirForLogs); try { if (myDebugPort != null) { //noinspection UseOfSystemOutOrSystemErr System.out.println("Listening for transport dt_socket at address: " + myDebugPort); } MavenRemoteProcessSupportFactory factory = MavenRemoteProcessSupportFactory.forProject(myProject); mySupport = factory.create(myJdk, myVmOptions, myDistribution, myProject, myDebugPort); mySupport.onTerminate(e -> { MavenLog.LOG.debug("[connector] terminate " + MavenServerConnectorImpl.this); MavenServerManager mavenServerManager = ApplicationManager.getApplication().getServiceIfCreated(MavenServerManager.class); if (mavenServerManager != null) { mavenServerManager.shutdownConnector(MavenServerConnectorImpl.this, false); } }); // Maven server's lifetime is bigger than the activity that spawned it, so we let it go untracked try (AccessToken ignored = ThreadContext.resetThreadContext()) { MavenServer server = mySupport.acquire(this, "", indicator); startPullingDownloadListener(server); startPullingLogger(server); myServerPromise.setResult(server); } MavenLog.LOG.debug("[connector] in " + dirForLogs + " has been connected " + MavenServerConnectorImpl.this); } catch (Throwable e) { MavenLog.LOG.warn("[connector] cannot connect in " + dirForLogs, e); myServerPromise.setError(e); } }