本文整理汇总了Java中org.apache.tools.ant.types.Commandline.Argument类的典型用法代码示例。如果您正苦于以下问题:Java Argument类的具体用法?Java Argument怎么用?Java Argument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Argument类属于org.apache.tools.ant.types.Commandline包,在下文中一共展示了Argument类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.apache.tools.ant.types.Commandline.Argument; //导入依赖的package包/类
protected void setup(Java java) {
if (jarFile != null) {
java.setJar(jarFile);
} else {
if (classPath == null) {
java.setClasspath(Path.systemClasspath);
} else {
java.setClasspath(new Path(java.getProject(), classPath));
}
java.setClassname(mainClass);
}
if (jvmArgs != null) {
final Argument jvmArg = java.createJvmarg();
jvmArg.setLine(jvmArgs);
}
if (args != null) {
final Argument taskArgs = java.createArg();
taskArgs.setLine(args);
}
java.getProject().addBuildListener(new SimpleListener(java, outputOut, outputErr));
java.setCloneVm(cloneVM);
}
开发者ID:openimaj,项目名称:openimaj,代码行数:27,代码来源:JavaProcess.java
示例2: installLicense
import org.apache.tools.ant.types.Commandline.Argument; //导入依赖的package包/类
protected void installLicense() throws MojoExecutionException, IOException {
if (licenseArtifact != null) {
Artifact license = getArtifact(licenseArtifact);
if (!hasSameLicense(license)) {
log.info(MessageFormat.format(messages.getString("info.install.license"),
licenseArtifact.getGroupId() + ":" + licenseArtifact.getArtifactId() + ":" + licenseArtifact.getVersion()));
Java installLicenseTask = (Java) ant.createTask("java");
installLicenseTask.setJar(license.getFile());
Argument args = installLicenseTask.createArg();
args.setLine("--acceptLicense " + assemblyInstallDirectory.getCanonicalPath());
installLicenseTask.setTimeout(30000L);
installLicenseTask.setFork(true);
int rc = installLicenseTask.executeJava();
if (rc != 0) {
throw new MojoExecutionException(MessageFormat.format(messages.getString("error.install.license"),
licenseArtifact.getGroupId() + ":" + licenseArtifact.getArtifactId() + ":" + licenseArtifact.getVersion(), rc));
}
}
}
}
开发者ID:WASdev,项目名称:ci.maven,代码行数:21,代码来源:BasicSupport.java
示例3: createJvmArg
import org.apache.tools.ant.types.Commandline.Argument; //导入依赖的package包/类
public Argument createJvmArg() {
Argument arg = new Argument();
jvmArgs.add(arg);
return arg;
}
开发者ID:google,项目名称:error-prone,代码行数:6,代码来源:ErrorProneExternalCompilerAdapter.java
示例4: execute
import org.apache.tools.ant.types.Commandline.Argument; //导入依赖的package包/类
@Override
public boolean execute() throws BuildException {
if (getJavac().isForkedJavac()) {
attributes.log("Using external Error Prone compiler", Project.MSG_VERBOSE);
Commandline cmd = new Commandline();
cmd.setExecutable(JavaEnvUtils.getJdkExecutable("java"));
if (memoryStackSize != null) {
cmd.createArgument().setValue("-Xss" + memoryStackSize);
}
String memoryParameterPrefix = "-X";
if (memoryInitialSize != null) {
cmd.createArgument().setValue(memoryParameterPrefix + "ms" + this.memoryInitialSize);
// Prevent setupModernJavacCommandlineSwitches() from doing it also
memoryInitialSize = null;
}
if (memoryMaximumSize != null) {
cmd.createArgument().setValue(memoryParameterPrefix + "mx" + this.memoryMaximumSize);
// Prevent setupModernJavacCommandlineSwitches() from doing it also
memoryMaximumSize = null;
}
for (Argument arg : jvmArgs) {
for (String part : arg.getParts()) {
cmd.createArgument().setValue(part);
}
}
Path bootclasspath = new Path(getProject());
addResourceSource(
bootclasspath, "com/google/errorprone/ErrorProneExternalCompilerAdapter.class");
cmd.createArgument().setValue("-Xbootclasspath/p:" + bootclasspath);
if (classpath != null) {
cmd.createArgument().setValue("-classpath");
cmd.createArgument().setPath(classpath);
}
cmd.createArgument().setValue(ErrorProneCompiler.class.getName());
// This is the first argument that may be spilled to a file.
// The ant API describes it as the first argument which is a
// file, but in fact only uses it for spilling. Putting the
// break here allows long classpath arguments to be handled.
int firstSpillableArgument = cmd.size();
setupModernJavacCommandlineSwitches(cmd);
logAndAddFilesToCompile(cmd);
return executeExternalCompile(cmd.getCommandline(), firstSpillableArgument, true) == 0;
} else {
attributes.log(
"You must set fork=\"yes\" to use the external Error Prone compiler", Project.MSG_ERR);
return false;
}
}
开发者ID:google,项目名称:error-prone,代码行数:52,代码来源:ErrorProneExternalCompilerAdapter.java
示例5: execute
import org.apache.tools.ant.types.Commandline.Argument; //导入依赖的package包/类
/**
* Do the execution.
* @throws BuildException if failOnError is set to true and the application
* returns a nonzero result code.
*/
public void execute() throws BuildException {
ClassLoader loader = SpassMeterTask.class.getClassLoader();
if (loader instanceof AntClassLoader) {
AntClassLoader aLoader = (AntClassLoader) loader;
StringTokenizer tokens = new StringTokenizer(
aLoader.getClasspath(), File.pathSeparator);
boolean found = false;
while (tokens.hasMoreTokens()) {
String path = tokens.nextToken();
if (path.endsWith("spass-meter-ant.jar")) {
found = true;
getCommandLine().getClasspath().add(
new Path(getProject(), path));
}
}
if (!found) {
System.err.println(
"Cannot find SPASS-meter (ANT distribution)");
}
} else {
System.err.println("Unexpected class loader: "
+ loader.getClass().getName());
}
// getCommandLine().getClasspath().add(new );
setClassname(de.uni_hildesheim.sse.monitoring.runtime.preprocess.
Preprocess.class.getName());
if (null == in) {
throw new BuildException("in file(s) must be provided");
}
if (null == out) {
throw new BuildException("out file or directory must be provided");
}
StringBuilder inArg = new StringBuilder();
StringTokenizer token = new StringTokenizer(in, ",");
File f;
while (token.hasMoreTokens()) {
f = new File(token.nextToken().trim());
if (null != dir && !f.isAbsolute()) {
f = new File(dir, f.toString());
}
inArg.append(f.getAbsolutePath());
if (token.hasMoreTokens()) {
inArg.append(",");
}
}
Argument arg = createArg();
arg.setValue(inArg.toString());
f = out;
if (null != dir && !f.isAbsolute()) {
f = new File(dir, f.toString());
}
arg = createArg();
arg.setValue(f.getAbsolutePath());
if (null != params) {
arg = createArg();
arg.setValue(params);
}
super.execute();
}
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:70,代码来源:SpassMeterTask.java
示例6: main
import org.apache.tools.ant.types.Commandline.Argument; //导入依赖的package包/类
public static void main(String[] args) {
// global ant project settings
Project project = new Project();
project.setBaseDir(new File(System.getProperty("user.dir")));
project.init();
DefaultLogger logger = new DefaultLogger();
project.addBuildListener(logger);
logger.setOutputPrintStream(System.out);
logger.setErrorPrintStream(System.err);
logger.setMessageOutputLevel(Project.MSG_INFO);
System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
project.fireBuildStarted();
Throwable caught = null;
try {
// an echo example
Echo echo = new Echo();
echo.setTaskName("Echo");
echo.setProject(project);
echo.init();
echo.setMessage("Launching ...");
echo.execute();
/** initialize an java task **/
Java javaTask = new Java();
javaTask.setNewenvironment(true);
javaTask.setTaskName("runjava");
javaTask.setProject(project);
javaTask.setFork(true);
javaTask.setFailonerror(true);
javaTask.setClassname(MyClassToLaunch.class.getName());
// add some vm args
Argument jvmArgs = javaTask.createJvmarg();
jvmArgs.setLine("-Xms512m -Xmx512m");
// added some args for to class to launch
Argument taskArgs = javaTask.createArg();
taskArgs.setLine("bla path=/tmp/");
Path classPath = new Path(project, new File(System.getProperty("user.dir") + "/bin/test").getAbsolutePath());
javaTask.setClasspath(classPath);
javaTask.init();
int ret = javaTask.executeJava();
System.out.println("return code: " + ret);
} catch (BuildException e) {
caught = e;
}
project.log("finished");
project.fireBuildFinished(caught);
}
开发者ID:th-schwarz,项目名称:pmcms,代码行数:56,代码来源:MyLauncher.java
注:本文中的org.apache.tools.ant.types.Commandline.Argument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论