void (@NotNull Project project, @NotNull @Nls String executionName, @NotNull String projectPath, @NotNull String gradlePath, @NotNull ProgressExecutionMode progressExecutionMode, @Nullable TaskCallback callback, @NotNull String initScript, @NotNull String taskName) { UserDataHolderBase userData = new UserDataHolderBase(); userData.putUserData(INIT_SCRIPT_KEY, initScript); userData.putUserData(ExternalSystemRunConfiguration.PROGRESS_LISTENER_KEY, SyncViewManager.class); String gradleVmOptions = GradleSettings.getInstance(project).getGradleVmOptions(); ExternalSystemTaskExecutionSettings settings = new ExternalSystemTaskExecutionSettings(); settings.setExecutionName(executionName); settings.setExternalProjectPath(projectPath); String taskPrefix = gradlePath.endsWith(":") ? gradlePath : gradlePath + ':'; settings.setTaskNames(Collections.singletonList(taskPrefix + taskName)); settings.setVmOptions(gradleVmOptions); settings.setExternalSystemIdString(GradleConstants.SYSTEM_ID.getId()); ExternalSystemUtil.runTask(settings, DefaultRunExecutor.EXECUTOR_ID, project, GradleConstants.SYSTEM_ID, callback, progressExecutionMode, false, userData); }