in src/org/jetbrains/jps/runConf/java/JavaBasedRunConfigurationLauncher.groovy [68:119]
final void startInternal(RunConfiguration runConf, ProjectBuilder projectBuilder) {
def project = runConf.project;
def ant = projectBuilder.binding.ant;
def params = [
mainClass: getMainClassName(runConf),
jvmArgs: getJVMArguments(runConf),
classArgs: getMainClassArguments(runConf)
];
def module = runConf.module;
def runConfRuntimeCp = getRuntimeClasspath(runConf, projectBuilder);
def attrs = [:];
def sdk = module?.sdk ? module.sdk : project.projectSdk;
if (sdk != null) {
attrs["jvm"] = sdk.getJavaExecutable();
} else {
projectBuilder.warning("Cannot find java executable, will use java of the current process.");
}
attrs["classname"] = MainClassLauncher.class.getName();
attrs["classpath"] = ClasspathUtil.composeClasspath([MainClassLauncher] as Class[]);
attrs["fork"] = "true";
attrs["dir"] = runConf.workingDir;
attrs["logError"] = "true";
attrs["failonerror"] = "true";
if (myOutputFile != null) {
attrs["output"] = myOutputFile.absolutePath;
}
if (myErrorFile != null) {
attrs["error"] = myErrorFile.absolutePath;
}
def runConfRuntimeCpFile = createTempFile(runConfRuntimeCp);
def mainClassCpFile = createTempFile(getMainClassClasspath(runConf));
def tmpArgs = createTempFile(splitCommandArgumentsAndUnquote(params.classArgs));
projectBuilder.info("Starting run configuration $runConf.name ...");
ant.java(attrs) {
arg(line: "$params.mainClass \"$mainClassCpFile\" \"$runConfRuntimeCpFile\" \"$tmpArgs\"");
jvmarg(line: params.jvmArgs);
for (Map.Entry<String, String> envVar: runConf.envVars.entrySet()) {
env(key: envVar.getKey(), value: envVar.getValue());
}
for (Map.Entry<String, String> propEntry: getSystemProperties(runConf).entrySet()) {
sysproperty(key: propEntry.getKey(), value: propEntry.getValue());
}
};
}