提交 56f60d0e 编写于 作者: K kohsuke

more convenience methods.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@31780 71c3de6d-444a-0410-be80-ed276b4c234a
上级 a88a4a74
......@@ -43,6 +43,7 @@ public class JVMBuilder implements Serializable {
private final ClasspathBuilder classpath = new ClasspathBuilder();
private final Map<String,String> systemProperties = new TreeMap<String,String>();
private final ArgumentListBuilder args = new ArgumentListBuilder();
private final ArgumentListBuilder vmopts = new ArgumentListBuilder();
private FilePath pwd;
private String mainClass;
......@@ -75,6 +76,13 @@ public class JVMBuilder implements Serializable {
return args;
}
/**
* JVM options.
*/
public ArgumentListBuilder vmopts() {
return vmopts;
}
/**
* Sets the current directory for the new JVM.
*/
......@@ -83,6 +91,14 @@ public class JVMBuilder implements Serializable {
return this;
}
/**
* Enables the debugger support on the given port.
*/
public JVMBuilder debug(int port) {
vmopts.add("-Xrunjdwp:transport=dt_socket,server=y,address="+port);
return this;
}
/**
* Sets the current directory for the new JVM.
* This overloaded version only makes sense when you are launching JVM locally.
......@@ -105,6 +121,7 @@ public class JVMBuilder implements Serializable {
args.add(new File(System.getProperty("java.home"),"bin/java")); // TODO: if we are to support a remote launch, JVM would be on a different path.
args.addKeyValuePairs("-D",systemProperties);
args.add("-cp").add(classpath.toString());
args.add(this.vmopts.toCommandArray());
args.add(mainClass);
args.add(this.args.toCommandArray());
return args;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册