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

x33g5p2x  于2022-01-19 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(142)

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

Execute.setEnvironment介绍

[英]Sets the environment variables for the subprocess to launch.
[中]

代码示例

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

/**
 * Set up our environment variables.
 * @param exe executable.
 */
private void setupEnvironment(Execute exe) {
  String[] environment = env.getVariables();
  if (environment != null) {
    for (String element : environment) {
      log("Setting environment variable: " + element,
        Project.MSG_VERBOSE);
    }
  }
  exe.setNewenvironment(newEnvironment);
  exe.setEnvironment(environment);
}

代码示例来源:origin: org.testng/testng

execute.setEnvironment(environment);

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

exe.setEnvironment(env.getVariables());

代码示例来源:origin: cbeust/testng

execute.setEnvironment(environment);

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

newEnv[env.length] = "SSDIR=" + serverPath;
exe.setEnvironment(newEnv);

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

/**
 * Create an Execute instance with the correct working directory set.
 *
 * @return an instance of the Execute class.
 *
 * @throws BuildException under unknown circumstances.
 */
protected Execute prepareExec() throws BuildException {
  // default directory to the project's base directory
  if (dir == null) {
    dir = getProject().getBaseDir();
  }
  if (redirectorElement != null) {
    redirectorElement.configure(redirector);
  }
  Execute exe = new Execute(createHandler(), createWatchdog());
  exe.setAntRun(getProject());
  exe.setWorkingDirectory(dir);
  exe.setVMLauncher(vmLauncher);
  String[] environment = env.getVariables();
  if (environment != null) {
    for (String variable : environment) {
      log("Setting environment variable: " + variable,
          Project.MSG_VERBOSE);
    }
  }
  exe.setNewenvironment(newEnvironment);
  exe.setEnvironment(environment);
  return exe;
}

代码示例来源:origin: org.apache.geronimo.testsupport/testsupport-commands

public void execute(String command, List<String> args, InputStream in, OutputStream out) throws Exception {
  List<String> cmdLine = new ArrayList<String>();
  if (isWindows()) {
    cmdLine.add("cmd.exe");
    cmdLine.add("/c");
  }
  cmdLine.add(resolveCommandForOS(command));
  // add command-specific arguments
  cmdLine.addAll(getCommandArguments(command));
  // add user arguments
  if (args != null) {
    cmdLine.addAll(args);
  }
  
  ExecuteWatchdog watchdog = new ExecuteWatchdog( timeout );
  ExecuteStreamHandler streamHandler = new PumpStreamHandler( out, out, in );
  Execute exec = new Execute( streamHandler, watchdog );
  exec.setCommandline( cmdLine.toArray(new String[] {}) );
  List<String> env = getCommandEnvironment(command);
  if (!env.isEmpty()) {
    exec.setEnvironment(env.toArray(new String[] {}) );
  }
  exec.execute();
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

executor.setAntRun(getProject());
executor.setWorkingDirectory(getProject().getBaseDir());
executor.setEnvironment(addClasspathToEnvironment(executor.getEnvironment(), classpath.toString()));
executor.setCommandline(commandLine);
try {

代码示例来源:origin: org.jvnet.hudson.plugins/cvs

exe.setEnvironment(env.getVariables());

代码示例来源:origin: org.hudsonci.plugins/cvs

exe.setEnvironment(env.getVariables());

代码示例来源:origin: com.carrotsearch.randomizedtesting/junit4-ant

execute.setNewenvironment(newEnvironment);
if (env.getVariables() != null)
 execute.setEnvironment(env.getVariables());
log("Starting JVM J" + slaveInfo.id, Project.MSG_DEBUG);
execute.execute();

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

execute.setNewenvironment(newEnvironment);
if (env.getVariables() != null)
 execute.setEnvironment(env.getVariables());
log("Starting JVM J" + slaveInfo.id, Project.MSG_DEBUG);
execute.execute();

代码示例来源:origin: Alexey1Gavrilov/ExpectIt

exec.setAntRun(getProject());
exec.setWorkingDirectory(original.getWorkingDirectory());
exec.setEnvironment(original.getEnvironment());
return exec;

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

execute.setEnvironment(environment);

相关文章