public Commandline createCommandLine(List classPath) throws SurefireBooterForkException {
return createCommandLine(classPath, false);
}
public Commandline createCommandLine(List classPath, boolean useJar) throws SurefireBooterForkException {
Commandline cli = new Commandline();
cli.setExecutable(jvmExecutable);
if (argLine != null) {
cli.createArg().setLine(argLine);
}
if (environmentVariables != null) {
Iterator iter = environmentVariables.keySet().iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
String value = (String)environmentVariables.get(key);
cli.addEnvironment(key, value);
}
}
if (debugLine != null && !"".equals(debugLine)) {
cli.createArg().setLine(debugLine);
}
if (useJar) {
File jarFile;
try {
jarFile = createJar(classPath);
} catch (IOException e) {
throw new SurefireBooterForkException("Error creating archive file", e);
}
cli.createArg().setValue("-jar");
cli.createArg().setValue(jarFile.getAbsolutePath());
} else {
cli.createArg().setValue("-classpath");
cli.createArg().setValue(StringUtils.join(classPath.iterator(), File.pathSeparator));
cli.createArg().setValue(OSGiSurefireBooter.class.getName());
}
cli.setWorkingDirectory(workingDirectory.getAbsolutePath());
return cli;
}