hudson.model.JDK.forNode()方法的使用及代码示例

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

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

JDK.forNode介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Override
public EnvVars getEnvironment(Node node, TaskListener listener) throws IOException, InterruptedException {
  EnvVars env =  super.getEnvironment(node, listener);
  JDK jdkTool = getJDK();
  if (jdkTool != null) {
    if (node != null) { // just in case were not in a build
      jdkTool = jdkTool.forNode(node, listener);
    }
    jdkTool.buildEnvVars(env);
  } else if (!JDK.isDefaultName(jdk)) {
    listener.getLogger().println("No JDK named ‘" + jdk + "’ found");
  }
  return env;
}

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

@CheckForNull
public JDK getJava(TaskListener log) throws IOException, InterruptedException {
  JDK jdk = mms.getJDK();
  if (jdk != null) jdk = jdk.forNode(getCurrentNode(), log).forEnvironment(envVars);
  return jdk;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
public EnvVars getEnvironment(Node node, TaskListener listener) throws IOException, InterruptedException {
  EnvVars env =  super.getEnvironment(node, listener);
  JDK jdkTool = getJDK();
  if (jdkTool != null) {
    if (node != null) { // just in case were not in a build
      jdkTool = jdkTool.forNode(node, listener);
    }
    jdkTool.buildEnvVars(env);
  } else if (!JDK.isDefaultName(jdk)) {
    listener.getLogger().println("No JDK named ‘" + jdk + "’ found");
  }
  return env;
}

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

public JDK getJava(TaskListener log) throws IOException, InterruptedException {
  JDK jdk = mms.getJDK();
  if (jdk != null) jdk = jdk.forNode(getCurrentNode(), log).forEnvironment(envVars);
  return jdk;
}

代码示例来源:origin: jenkinsci/envinject-plugin

/**
 * Gets JDK variables.
 * For {@link AbstractBuild} it invokes operation on the node to retrieve the data; 
 * for other types it does nothing.
 * @param run Run
 * @param logger Logger
 * @param result Target collection, where the variables will be added
 * @throws IOException Operation failure
 * @throws InterruptedException Operation has been interrupted
 */
public static void getJDKVariables(@Nonnull Run<?, ?> run, TaskListener logger, EnvVars result) 
    throws IOException, InterruptedException {
  if (run instanceof AbstractBuild) {
    AbstractBuild b = (AbstractBuild) run;
    JDK jdk = b.getProject().getJDK();
    if (jdk != null) {
      Node node = b.getBuiltOn();
      if (node != null) {
        jdk = jdk.forNode(node, logger);
      }
      jdk.buildEnvVars(result);
    }
  }
}

代码示例来源:origin: SonarSource/sonar-scanner-jenkins

@Override
 protected void buildEnvVars(EnvVars env, MavenInstallation mi) throws IOException, InterruptedException {
  super.buildEnvVars(env, mi);
  // Override JDK in case it is set on Sonar publisher
  if (jdk != null) {
   Computer computer = Computer.currentComputer();
   if (computer != null) {
    // just in case were not in a build
    jdk = jdk.forNode(computer.getNode(), listener);
   }
   jdk.buildEnvVars(env);
  }
 }
}

代码示例来源:origin: SonarSource/sonar-scanner-jenkins

private void computeJdkToUse(Run<?, ?> build, FilePath workspace, TaskListener listener, EnvVars env) throws IOException, InterruptedException {
 JDK jdkToUse = getJdkToUse(getProject(build));
 if (jdkToUse != null) {
  Computer computer = workspace.toComputer();
  // just in case we are not in a build
  if (computer != null) {
   jdkToUse = jdkToUse.forNode(computer.getNode(), listener);
  }
  jdkToUse.buildEnvVars(env);
 }
}

代码示例来源:origin: jenkinsci/pipeline-maven-plugin

/**
 * Setup the selected JDK. If none is provided nothing is done.
 */
private void setupJDK() throws AbortException, IOException, InterruptedException {
  String jdkInstallationName = step.getJdk();
  if (StringUtils.isEmpty(jdkInstallationName)) {
    console.println("[withMaven] using JDK installation provided by the build agent");
    return;
  }
  if (withContainer) {
    // see #detectWithContainer()
    LOGGER.log(Level.FINE, "Ignoring JDK installation parameter: {0}", jdkInstallationName);
    console.println("WARNING: \"withMaven(){...}\" step running within a container," +
        " tool installations are not available see https://issues.jenkins-ci.org/browse/JENKINS-36159. " +
        "You have specified a JDK installation \"" + jdkInstallationName + "\", which will be ignored.");
    return;
  }
  console.println("[withMaven] using JDK installation " + jdkInstallationName);
  JDK jdk = Jenkins.getInstance().getJDK(jdkInstallationName);
  if (jdk == null) {
    throw new AbortException("Could not find the JDK installation: " + jdkInstallationName + ". Make sure it is configured on the Global Tool Configuration page");
  }
  Node node = getComputer().getNode();
  if (node == null) {
    throw new AbortException("Could not obtain the Node for the computer: " + getComputer().getName());
  }
  jdk = jdk.forNode(node, listener).forEnvironment(env);
  jdk.buildEnvVars(envOverride);
}

代码示例来源:origin: jenkinsci/fitnesse-plugin

jdk = jdk.forNode(node, listener);
java = getJavaBinFromjavaHome(workingDirectory, jdk.getHome());

代码示例来源:origin: jenkinsci/zap-plugin

/**
 * Set the JDK to use to start ZAP.
 *
 * @param build
 * @param listener
 *            of type BuildListener: the display log listener during the Jenkins job execution.
 * @param env
 *            of type EnvVars: list of environment variables. Used to set the path to the JDK.
 * @throws IOException
 * @throws InterruptedException
 */
private void computeJdkToUse(AbstractBuild<?, ?> build, BuildListener listener, EnvVars env) throws IOException, InterruptedException {
  JDK jdkToUse = getJdkToUse(build.getProject());
  if (jdkToUse != null) {
    Computer computer = Computer.currentComputer();
    /* just in case we are not in a build */
    if (computer != null) jdkToUse = jdkToUse.forNode(computer.getNode(), listener);
    jdkToUse.buildEnvVars(env);
  }
}

代码示例来源:origin: jenkinsci/sbt-plugin

if (computer != null && jdk != null) { // just in case were not in a build
  jdk = jdk.forNode(computer.getNode(), listener);

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
  EnvVars env = super.getEnvironment(log);
  FilePath ws = getWorkspace();
  if (ws!=null)   // if this is done very early on in the build, workspace may not be decided yet. see HUDSON-3997
    env.put("WORKSPACE", ws.getRemote());
  // servlet container may have set CLASSPATH in its launch script,
  // so don't let that inherit to the new child process.
  // see http://www.nabble.com/Run-Job-with-JDK-1.4.2-tf4468601.html
  env.put("CLASSPATH","");
  JDK jdk = project.getJDK();
  if (jdk != null) {
    Computer computer = Computer.currentComputer();
    if (computer != null) { // just in case were not in a build
      jdk = jdk.forNode(computer.getNode(), log);
    }
    jdk.buildEnvVars(env);
  }
  project.getScm().buildEnvVars(this,env);
  if (buildEnvironments!=null)
    for (Environment e : buildEnvironments)
      e.buildEnvVars(env);
  for (EnvironmentContributingAction a : Util.filter(getActions(),EnvironmentContributingAction.class))
    a.buildEnvVars(this,env);
  EnvVars.resolve(env);
  return env;
}

代码示例来源:origin: hudson/hudson-2.x

@Override
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
  EnvVars env = super.getEnvironment(log);
  FilePath ws = getWorkspace();
  if (ws!=null)   // if this is done very early on in the build, workspace may not be decided yet. see HUDSON-3997
    env.put("WORKSPACE", ws.getRemote());
  // servlet container may have set CLASSPATH in its launch script,
  // so don't let that inherit to the new child process.
  // see http://www.nabble.com/Run-Job-with-JDK-1.4.2-tf4468601.html
  env.put("CLASSPATH","");
  JDK jdk = project.getJDK();
  if (jdk != null) {
    Computer computer = Computer.currentComputer();
    if (computer != null) { // just in case were not in a build
      jdk = jdk.forNode(computer.getNode(), log);
    }
    jdk.buildEnvVars(env);
  }
  project.getScm().buildEnvVars(this,env);
  if (buildEnvironments!=null)
    for (Environment e : buildEnvironments)
      e.buildEnvVars(env);
  for (EnvironmentContributingAction a : Util.filter(getActions(),EnvironmentContributingAction.class))
    a.buildEnvVars(this,env);
  EnvVars.resolve(env);
  return env;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Override
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
  EnvVars env = super.getEnvironment(log);
  FilePath ws = getWorkspace();
  if (ws!=null)   // if this is done very early on in the build, workspace may not be decided yet. see HUDSON-3997
    env.put("WORKSPACE", ws.getRemote());
  // servlet container may have set CLASSPATH in its launch script,
  // so don't let that inherit to the new child process.
  // see http://www.nabble.com/Run-Job-with-JDK-1.4.2-tf4468601.html
  env.put("CLASSPATH","");
  JDK jdk = project.getJDK();
  if (jdk != null) {
    Computer computer = Computer.currentComputer();
    if (computer != null) { // just in case were not in a build
      jdk = jdk.forNode(computer.getNode(), log);
    }
    jdk.buildEnvVars(env);
  }
  project.getScm().buildEnvVars(this,env);
  if (buildEnvironments!=null)
    for (Environment e : buildEnvironments)
      e.buildEnvVars(env);
  for (EnvironmentContributingAction a : Util.filter(getActions(),EnvironmentContributingAction.class))
    a.buildEnvVars(this,env);
  EnvVars.resolve(env);
  return env;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

Computer computer = Computer.currentComputer();
if (computer != null) { // just in case were not in a build
  jdk = jdk.forNode(computer.getNode(), log);

相关文章