Is it possible to use OpenJDK-14 in Jenkins (Docker version)? I set the version in the Configurations by unpacking the JDK from this link: https://download.java.net/openjdk/jdk14/ri/openjdk-14+36_linux-x64_bin.tar.gz
This is my Jenkinsfile:
pipeline {
agent any
tools {
jdk 'jdk-14'
maven 'Maven-3-6-3'
}
stages {
stage("build project") {
steps {
sh 'java -version'
echo 'building project...'
sh 'mvn clean install'
}
}
}
}
This is the error i get:
mvn clean install
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JREAlso the sh 'java -version' command, still gives me this:
$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
Generally, you can install the "Jenkins AdoptOpenJDK installer Plugin"
Then in your Global Tool Configuration | Add JDK (${JENKINSURL}/configureTools/), you will
If you have more than one JDK installed, in your jobs, you should now have an option to choose JDK or specify in the pipeline tools section.
Alternatively, you can just specify the path to where JDK14 is installed beforehand instead of dynamically installing.
It would seem you have the "installed beforehand" part done, but are missing the Global tool configuration, setting the path for jdk-14, so it's not overriding the SYSTEM default.
(obviously, pick from drop down or set path).