org.apache.tools.ant.taskdefs.Java.executeJava()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.apache.tools.ant.taskdefs.Java.executeJava()方法的一些代码示例,展示了Java.executeJava()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Java.executeJava()方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Java
类名称:Java
方法名:executeJava

Java.executeJava介绍

[英]Do the execution and return a return code.
[中]

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Do the execution and return a return code.
 *
 * @return the return code from the execute java class if it was
 * executed in a separate VM (fork = "yes") or a security manager was
 * installed that prohibits ExitVM (default).
 *
 * @throws BuildException if required parameters are missing.
 */
public int executeJava() throws BuildException {
  return executeJava(getCommandLine());
}

代码示例来源:origin: org.apache.ant/ant

if (helperTask.executeJava() != 0) {
  log(filename + " failed to compile", Project.MSG_WARN);

代码示例来源:origin: org.apache.ant/ant

/**
 * Do the execution.
 * @throws BuildException if failOnError is set to true and the application
 * returns a nonzero result code.
 */
@Override
public void execute() throws BuildException {
  File savedDir = dir;
  Permissions savedPermissions = perm;
  int err = -1;
  try {
    checkConfiguration();
    err = executeJava();
    if (err != 0) {
      if (failOnError) {
        throw new ExitStatusException("Java returned: " + err,
            err,
            getLocation());
      } else {
        log("Java Result: " + err, Project.MSG_ERR);
      }
    }
    maybeSetResultPropertyValue(err);
  } finally {
    dir = savedDir;
    perm = savedPermissions;
  }
}

代码示例来源:origin: spotbugs/spotbugs

int rc = findbugsEngine.executeJava();

代码示例来源:origin: org.apache.ant/ant

Project.MSG_VERBOSE);
if (javaTask.executeJava() != 0) {
  throw new BuildException("Ejbc reported an error");

代码示例来源:origin: org.apache.ant/ant

+ File.separator + descriptorName + ".", Project.MSG_VERBOSE);
if (genicTask.executeJava() != 0) {

代码示例来源:origin: codehaus-cargo/cargo

/**
 * {@inheritDoc}
 */
@Override
public int execute() throws JvmLauncherException
{
  try
  {
    return this.java.executeJava();
  }
  catch (BuildException e)
  {
    throw new JvmLauncherException(e.getMessage(), e);
  }
}

代码示例来源:origin: org.ow2.jonas/bootstrap-ant

/**
 * Run the task.
 * @see org.apache.tools.ant.Task#execute()
 */
public void execute() {
  // Start the task
  Java bootstrapTask = getBootstraptask(mode.getMainClass());
  mode.configureJava(bootstrapTask);
  bootstrapTask.executeJava();
}

代码示例来源:origin: scriptella/scriptella-etl

int r = j.executeJava();
if (r != 0) {
  throw new BuildException("Unable to execute files: " + files +

代码示例来源:origin: apache/royale-compiler

/**
 * Executes the task in a separate VM
 */
private void executeOutOfProcess() throws BuildException
{
  try
  {
    // Without this, the tool class won't be found by executeJava().
    Class<?> toolClass = resolveClass(toolClassName);
    
    super.setClassname(toolClassName);
    // convert arguments into a string for use by executeJava()
    // also auto-quotes arguments with spaces
    String line = Commandline.toString(cmdline.getArguments());
    super.createArg().setLine(line);
    int exitCode = super.executeJava();
    // Check exit code.
    if (isFatalFailure(toolClass, exitCode))
      throw new BuildException(taskName + " task failed.");
  }
  finally
  {
    if (originalContextClassLoader != null)
      Thread.currentThread().setContextClassLoader(originalContextClassLoader);
  }
}

代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks

protected void installLiberty(File jarFile) throws Exception {
  Java java = (Java) getProject().createTask("java");
  java.setJar(jarFile);
  java.setFork(true);
  java.createArg().setValue("-acceptLicense");
  java.createArg().setValue(baseDir);
  int exitCode = java.executeJava();
  if (exitCode != 0) {
    throw new BuildException("Error installing Liberty.");
  }
}

代码示例来源:origin: net.sf.antenna/antenna

private void executeMPowerEmulator(String device) throws BuildException {
  String arguments = utility.getQuotedName(jadFile);
      
  log("Arguments : " + arguments, Project.MSG_VERBOSE);
  Java java = new Java();
  java.setProject(getProject());
  java.setTaskName(getTaskName());
  java.setFork(true);
  java.setJar(new File(utility.getWtkRelative("player.jar")));
  java.setArgs(arguments);
  java.executeJava();
}

代码示例来源:origin: org.ow2.jonas/bootstrap-ant

bootstrapTask.executeJava();

代码示例来源:origin: axis/axis-ant

private void executeForkedAntTask() {
  /* if (callee2 == null) { */
    callee2 = (Java) getProject().createTask("java");
    callee2.setOwningTarget(getOwningTarget());
    callee2.setTaskName(getTaskName());
    callee2.setLocation(getLocation());
    callee2.setClassname("org.apache.tools.ant.Main");
    callee2.setAppend(true);
    callee2.setFork(true);
    callee2.createJvmarg().setValue("-Xbootclasspath/p:" + System.getProperty("sun.boot.class.path"));
  /* }                      */
  String systemClassPath = System.getProperty("java.class.path");
  callee2.setClasspath(new Path(getProject(), systemClassPath));
  String args = "-buildfile " + properties.get("file");
  Commandline.Argument arguments = callee2.createArg();
  arguments.setLine(args);
  if (verbose) {
    callee2.createArg().setValue("-verbose");
  }
  callee2.createArg().setValue(subTarget);
  if (callee2.executeJava() != 0) {
    throw new BuildException("Execution of ANT Task failed");
  }
}

代码示例来源:origin: net.sourceforge.cobertura/cobertura

public void execute() throws BuildException {
  CommandLineBuilder builder = null;
  try {
    builder = new CommandLineBuilder();
    if (dataFile != null)
      builder.addArg("--datafile", dataFile);
    createArgumentsForFilesets(builder);
    builder.saveArgs();
  } catch (IOException ioe) {
    getProject().log("Error creating commands file.", Project.MSG_ERR);
    throw new BuildException("Unable to create the commands file.", ioe);
  }
  // Execute GPL licensed code in separate virtual machine
  getJava().createArg().setValue("--commandsfile");
  getJava().createArg().setValue(builder.getCommandLineFile());
  AntUtil.transferCoberturaDataFileProperty(getJava());
  if (getJava().executeJava() != 0) {
    throw new BuildException(
        "Error running reports. See messages above.");
  }
  builder.dispose();
}

代码示例来源:origin: christ66/cobertura

public void execute() throws BuildException {
  CommandLineBuilder builder = null;
  try {
    builder = new CommandLineBuilder();
    if (dataFile != null)
      builder.addArg("--datafile", dataFile);
    createArgumentsForFilesets(builder);
    builder.saveArgs();
  } catch (IOException ioe) {
    getProject().log("Error creating commands file.", Project.MSG_ERR);
    throw new BuildException("Unable to create the commands file.", ioe);
  }
  // Execute GPL licensed code in separate virtual machine
  getJava().createArg().setValue("--commandsfile");
  getJava().createArg().setValue(builder.getCommandLineFile());
  AntUtil.transferCoberturaDataFileProperty(getJava());
  if (getJava().executeJava() != 0) {
    throw new BuildException(
        "Error running reports. See messages above.");
  }
  builder.dispose();
}

代码示例来源:origin: wvengen/proguard-maven-plugin

int result = java.executeJava();
if (result != 0) {
  throw new MojoExecutionException("Obfuscation failed (result=" + result + ")");

代码示例来源:origin: net.sourceforge.purrpackage/purrpackage

getJava().setError(new File("purrPackageReporter.err"));
transferCoberturaDataFileProperty(getJava());
if (getJava().executeJava() != 0) {
  throw new BuildException(
      "Error running reports. See messages above.");

代码示例来源:origin: net.sourceforge.cobertura/cobertura

public void execute() throws BuildException {
  CommandLineBuilder builder = null;
  try {
    builder = new CommandLineBuilder();
    if (dataFile != null)
      builder.addArg("--datafile", dataFile);
    if (destDir != null)
      builder.addArg("--destination", destDir.getAbsolutePath());
    if (format != null)
      builder.addArg("--format", format);
    if (encoding != null)
      builder.addArg("--encoding", encoding);
    if (srcDir != null)
      builder.addArg(srcDir);
    createArgumentsForFilesets(builder);
    builder.saveArgs();
  } catch (IOException ioe) {
    getProject().log("Error creating commands file.", Project.MSG_ERR);
    throw new BuildException("Unable to create the commands file.", ioe);
  }
  // Execute GPL licensed code in separate virtual machine
  getJava().createArg().setValue("--commandsfile");
  getJava().createArg().setValue(builder.getCommandLineFile());
  AntUtil.transferCoberturaDataFileProperty(getJava());
  if (getJava().executeJava() != 0) {
    throw new BuildException(
        "Error running reports. See messages above.");
  }
  builder.dispose();
}

代码示例来源:origin: christ66/cobertura

public void execute() throws BuildException {
  CommandLineBuilder builder = null;
  try {
    builder = new CommandLineBuilder();
    if (dataFile != null)
      builder.addArg("--datafile", dataFile);
    if (destDir != null)
      builder.addArg("--destination", destDir.getAbsolutePath());
    if (format != null)
      builder.addArg("--format", format);
    if (encoding != null)
      builder.addArg("--encoding", encoding);
    if (srcDir != null)
      builder.addArg(srcDir);
    createArgumentsForFilesets(builder);
    builder.saveArgs();
  } catch (IOException ioe) {
    getProject().log("Error creating commands file.", Project.MSG_ERR);
    throw new BuildException("Unable to create the commands file.", ioe);
  }
  // Execute GPL licensed code in separate virtual machine
  getJava().createArg().setValue("--commandsfile");
  getJava().createArg().setValue(builder.getCommandLineFile());
  AntUtil.transferCoberturaDataFileProperty(getJava());
  if (getJava().executeJava() != 0) {
    throw new BuildException(
        "Error running reports. See messages above.");
  }
  builder.dispose();
}

相关文章