void (@NotNull ExternalSystemTaskId id, @NotNull List<String> tasks, @NotNull String projectPath, @NotNull GradleExecutionSettings settings, @Nullable String jvmParametersSetup, @NotNull ExternalSystemTaskNotificationListener listener, @NotNull ProjectConnection connection, @NotNull CancellationTokenSource cancellationTokenSource) { BuildEnvironment buildEnvironment = null; try { buildEnvironment = GradleExecutionHelper.getBuildEnvironment(connection, id, listener, cancellationTokenSource, settings); var gradleVersion = getGradleVersion(buildEnvironment); setupGradleScriptDebugging(settings); setupDebuggerDispatchPort(settings); setupBuiltInTestEvents(settings, gradleVersion); appendInitScriptArgument(tasks, jvmParametersSetup, settings, gradleVersion); for (GradleBuildParticipant buildParticipant : settings.getExecutionWorkspace().getBuildParticipants()) { settings.withArguments(GradleConstants.INCLUDE_BUILD_CMD_OPTION, buildParticipant.getProjectPath()); } prepareTaskState(id, settings, listener); if (Registry.is("gradle.report.recently.saved.paths")) { ApplicationManager.getApplication() .getService(GradleFileModificationTracker.class) .notifyConnectionAboutChangedPaths(connection); } if (isApplicableTestLauncher(id, projectPath, tasks, settings, gradleVersion)) { TestLauncher launcher = myHelper.getTestLauncher(connection, id, tasks, settings, listener); launcher.withCancellationToken(cancellationTokenSource.token()); launcher.run(); } else { BuildLauncher launcher = myHelper.getBuildLauncher(connection, id, tasks, settings, listener); launcher.withCancellationToken(cancellationTokenSource.token()); launcher.run(); } GradleTaskResultListener.EP_NAME.forEachExtensionSafe(ext -> ext.onSuccess(id, projectPath)); } catch (RuntimeException e) { LOG.debug("Gradle build launcher error", e); final GradleProjectResolverExtension projectResolverChain = GradleProjectResolver.createProjectResolverChain(); throw projectResolverChain.getUserFriendlyError(buildEnvironment, e, projectPath, null); } }