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 ) ; }
Setup the selected JDK . If none is provided nothing is done .