Issue
- You want to select which Java JDK to use in Pipeline
Environment
- CloudBees Jenkins Enterprise
- Pipeline plugin
Resolution
As an example, in case you have a node called vagrant-slave and the tool is called jdk-8u45. The below code is what you should use to set-up the JAVA_HOME.
node('vagrant-slave') {
env.JAVA_HOME="${tool 'jdk-8u45'}"
env.PATH="${env.JAVA_HOME}/bin:${env.PATH}"
sh 'java -version'
}
Comments
1 comment
Works for me. Thank you!
Please sign in to leave a comment.