Created
November 12, 2018 15:48
-
-
Save mkutz/046038d07859b7d408accd162ab93b2d to your computer and use it in GitHub Desktop.
Configure JDK installations in Jenkins using a post-initialization script (https://wiki.jenkins.io/display/JENKINS/Post-initialization+script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.JDK | |
/* | |
* Configure the locations of multiple JDKs | |
* Note that this won't install anything, it just makes Jenkins aware of JDK installations | |
*/ | |
Jenkins.instance.getDescriptor(JDK).setInstallations( | |
new JDK("11", "/usr/lib/jvm/java-11-openjdk-amd64/"), | |
new JDK("8", "/usr/lib/jvm/java-8-openjdk-amd64/") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
tools { | |
jdk "11" | |
} | |
stages { | |
stage("Use maven") { | |
steps { | |
sh "java -version" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment