Search in sources :

Example 1 with JDK

use of hudson.model.JDK in project hudson-2.x by hudson.

the class MatrixProject method getJDKs.

/**
 * Gets the {@link JDK}s where the builds will be run.
 * @return never null but can be empty
 */
public Set<JDK> getJDKs() {
    Axis a = getAxes().find("jdk");
    if (a == null)
        return Collections.emptySet();
    Set<JDK> r = new HashSet<JDK>();
    for (String j : a) {
        JDK jdk = Hudson.getInstance().getJDK(j);
        if (jdk != null)
            r.add(jdk);
    }
    return r;
}
Also used : JDK(hudson.model.JDK) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with JDK

use of hudson.model.JDK in project sonar-scanner-jenkins by SonarSource.

the class SonarRunnerBuilder method computeJdkToUse.

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);
    }
}
Also used : JDK(hudson.model.JDK) Computer(hudson.model.Computer)

Example 3 with JDK

use of hudson.model.JDK in project configuration-as-code-plugin by jenkinsci.

the class JdkConfiguratorTest method configure_jdk_tool.

@Test
public void configure_jdk_tool() {
    final JDK.DescriptorImpl descriptor = ExtensionList.lookupSingleton(JDK.DescriptorImpl.class);
    assertEquals(1, descriptor.getInstallations().length);
    JDK jdk = descriptor.getInstallations()[0];
    assertEquals("jdk11", jdk.getName());
    assertEquals("/jdk", jdk.getHome());
    InstallSourceProperty installSourceProperty = jdk.getProperties().get(InstallSourceProperty.class);
    assertEquals(1, installSourceProperty.installers.size());
    AdoptOpenJDKInstaller installer = installSourceProperty.installers.get(AdoptOpenJDKInstaller.class);
    assertEquals("jdk-11.0.14+9", installer.id);
}
Also used : JDK(hudson.model.JDK) AdoptOpenJDKInstaller(io.jenkins.plugins.adoptopenjdk.AdoptOpenJDKInstaller) InstallSourceProperty(hudson.tools.InstallSourceProperty) Test(org.junit.Test)

Aggregations

JDK (hudson.model.JDK)3 Computer (hudson.model.Computer)1 InstallSourceProperty (hudson.tools.InstallSourceProperty)1 AdoptOpenJDKInstaller (io.jenkins.plugins.adoptopenjdk.AdoptOpenJDKInstaller)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Test (org.junit.Test)1