Source:
private void createRunConfigsTasks(@Nonnull Project project, ExtractNatives extractNatives, DownloadAssets downloadAssets, Map<String, RunConfig> runs) { project.getTasks().withType(GenerateEclipseClasspath.class, t -> { t.dependsOn(extractNatives, downloadAssets); }); TaskProvider<Task> prepareRun = project.getTasks().register("prepareRun", Task.class); prepareRun.configure(task -> { task.dependsOn(project.getTasks().getByName("classes"), extractNatives, downloadAssets); }); VersionJson json = null; try { json = Utils.loadJson(extractNatives.getMeta(), VersionJson.class); } catch (IOException e) List<String> additionalClientArgs = json != null ? json.getPlatformJvmArgs() : Collections.EMPTY_LIST; runs.forEach((name, runConfig) -> { if (runConfig.isClient()) runConfig.setJvmArgs(additionalClientArgs); String taskName = name.replaceAll("[^a-zA-Z0-9\\-_]",""); if (!taskName.startsWith("run")) taskName = "run" + taskName.substring(0,1).toUpperCase() + taskName.substring(1); TaskProvider<JavaExec> runTask = project.getTasks().register(taskName, JavaExec.class); runTask.configure(task -> { task.dependsOn(prepareRun.get()); task.setMain(runConfig.getMain()); task.setArgs(runConfig.getArgs()); task.systemProperties(runConfig.getProperties()); task.environment(runConfig.getEnvironment()); task.jvmArgs(runConfig.getJvmArgs()); String workDir = runConfig.getWorkingDirectory(); File file = new File(workDir); if(!file.exists()) file.mkdirs(); task.setWorkingDir(workDir); JavaPluginConvention java = (JavaPluginConvention)project.getConvention().getPlugins().get("java"); task.setClasspath(java.getSourceSets().getByName("main").getRuntimeClasspath()); }); }); EclipseHacks.doEclipseFixes(project, extractNatives, downloadAssets, runs); IntellijUtils.createIntellijRunsTask(project, extractNatives, downloadAssets, prepareRun.get(), runs); }

Target:
private void createRunConfigsTasks(@Nonnull Project project, ExtractNatives extractNatives, DownloadAssets downloadAssets, Map<String, RunConfig> runs) { project.getTasks().withType(GenerateEclipseClasspath.class, t -> { t.dependsOn(extractNatives, downloadAssets); }); TaskProvider<Task> prepareRun = project.getTasks().register("prepareRun", Task.class); prepareRun.configure(task -> { task.dependsOn(project.getTasks().getByName("classes"), extractNatives, downloadAssets); }); VersionJson json = null; try { json = Utils.loadJson(extractNatives.getMeta(), VersionJson.class); } catch (IOException e) List<String> additionalClientArgs = json != null ? json.getPlatformJvmArgs() : Collections.emptyList(); runs.forEach((name, runConfig) -> { if (runConfig.isClient()) runConfig.jvmArgs(additionalClientArgs); String taskName = name.replaceAll("[^a-zA-Z0-9\\-_]",""); if (!taskName.startsWith("run")) taskName = "run" + taskName.substring(0,1).toUpperCase() + taskName.substring(1); TaskProvider<JavaExec> runTask = project.getTasks().register(taskName, JavaExec.class); runTask.configure(task -> { task.dependsOn(prepareRun.get()); task.setMain(runConfig.getMain()); task.setArgs(runConfig.getArgs()); task.systemProperties(runConfig.getProperties()); task.environment(runConfig.getEnvironment()); task.jvmArgs(runConfig.getJvmArgs()); String workDir = runConfig.getWorkingDirectory(); File file = new File(workDir); if(!file.exists()) file.mkdirs(); task.setWorkingDir(workDir); JavaPluginConvention java = (JavaPluginConvention)project.getConvention().getPlugins().get("java"); task.setClasspath(java.getSourceSets().getByName("main").getRuntimeClasspath()); }); }); EclipseHacks.doEclipseFixes(project, extractNatives, downloadAssets, runs); IntellijUtils.createIntellijRunsTask(project, extractNatives, downloadAssets, prepareRun.get(), runs); }