public void exec(ClojureExecSpec cljSpec) { FileCollection fullClasspath = cljSpec.getClasspath(); project.javaexec(spec -> { spec.setMain("clojure.main"); spec.args("-m", cljSpec.getMain()); String ednArgs = Edn.print(Arrays.asList(cljSpec.getArgs())); ByteArrayInputStream input = new ByteArrayInputStream(ednArgs.getBytes(StandardCharsets.UTF_8)); spec.setStandardInput(input); spec.setClasspath(fullClasspath); cljSpec.getConfigureFork().forEach(forkAction -> forkAction.execute(spec)); spec.systemProperty("gradle-clojure.tools.logger.level", getLogLevel()); }); }
public void exec(ClojureExecSpec cljSpec) { FileCollection fullClasspath = cljSpec.getClasspath(); project.javaexec(spec -> { spec.setMain("clojure.main"); spec.args("-m", cljSpec.getMain()); String ednArgs = Edn.print(Arrays.asList(cljSpec.getArgs())); ByteArrayInputStream input = new ByteArrayInputStream(ednArgs.getBytes(StandardCharsets.UTF_8)); spec.setStandardInput(input); spec.setClasspath(fullClasspath); cljSpec.getConfigureFork().forEach(forkAction -> forkAction.execute(spec)); spec.systemProperty("gradle-clojure.tools.logger.level", getLogLevel()); }); }
@Override public void execute(JavaExecSpec javaExecSpec) { javaExecSpec.classpath(new File(javaProcessInfo.getClasspath())); javaExecSpec.setMain(javaProcessInfo.getMainClass()); javaExecSpec.args(javaProcessInfo.getArgs()); javaExecSpec.jvmArgs(javaProcessInfo.getJvmArgs()); javaExecSpec.environment(javaProcessInfo.getEnvironment()); javaExecSpec.setStandardOutput(processOutput.getStandardOutput()); javaExecSpec.setErrorOutput(processOutput.getErrorOutput()); // we run by default in headless mode, so the forked JVM doesn't steal focus. javaExecSpec.systemProperty("java.awt.headless", "true"); // we want the caller to be able to do its own thing. javaExecSpec.setIgnoreExitValue(true); } }