I have configured an alternate JDK (17) at the pipeline
level. How can I override that by telling a specific stage
to use the system JDK 8?
For example:
def call (body) {
def pipelineParams= [:]
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = pipelineParams
body()
pipeline {
tools {
maven 'apache-maven-3.9.3'
jdk 'EclipseTemurin-17' // Alternate JDK 17 added under Global Tool Configuration
}
stages {
stage('Build & Test App') {
steps {
build_jar()
}
}
stage('SonarQube Analysis') {
tools {
jdk "(System)" // < Does not work. How do I revert to system JDK 8?
}
steps {
sonarqube(pipelineParams.projectId)
}
}
}
}
}
This errors out that the (System)
JDK is unrecognized. However, This is how the system JDK is shown when adding a new Maven job:
So how can I tell Jenkins to use the system JDK within a stage, to override a non-default JDK used at the pipeline level?
Jenkins version: 2.346.3