I've found few topics related to this, but nothing new in terms of Java 14 and recent Jenkins versions. What are the recommended steps to make Java 14 available in Jenkins as an option to compile Java projects through jobs?
In my current installation, I cannot find the Configure JDK
option nor any drop-down to pick it up somewhere. I'm also a bit confused with several different ways that are recommeded to do that.
To use different java versions you need to configure it in main jenkins config menu "Manage jenkins" -> "Global tool configuration" -> "Add JDK"
. You can install some versions automatically or manually, but:
"Oracle Java SE 11+ is not available for business, commercial or production use without a commercial license. Public updates for Oracle Java SE 8 released after January 2019 will not be available for business, commercial or production use without a commercial license."
After then you will be able to add it into your job. For example use "tool" step in declarative pipeline:
pipeline {
agent any
tools {
nodejs 'java_8'
}
stages {
stage ('java test') {
steps {
sh 'java -version'
}
}
}
}