Promise<Object> (@NotNull PlaybackContext context) { String[] args = extractCommandArgument(PREFIX).split(" "); Project project = context.getProject(); Collection<GradleProjectSettings> settings = ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID).getLinkedProjectsSettings(); String taskName = args[0]; String projectPath = args.length == 2 ? settings.stream().filter(e -> e.getExternalProjectPath().contains(args[1])).findFirst().orElseThrow() .getExternalProjectPath() : Objects.requireNonNull(project.getBasePath()); ActionCallback actionCallback = new ActionCallbackProfilerStopper(); TaskData task = new TaskData(GradleConstants.SYSTEM_ID, taskName, projectPath, "Description"); runTask(project, task, actionCallback); return Promises.toPromise(actionCallback); }