-
Bug
-
Resolution: Unresolved
-
Minor
-
None
"default" JDK is the one present in user PATH - let's say JDK6
if I want to use an alternative JDK5, I declare it on system configuration
But I still can't edit my project configuration to select JDK and it still run with JDK6
I need to declare a 2nd JDK so that the select box appears and I can configure my JDK5 build.
I suggest to deprecate support for "Default" JDK, as this is confusing and dependent on host system configuration.
To ensure backward compatibility, jenkins could detect at startup jobs that don't have a <JDK> element in config and automatically create a "System" JDK in global configuration based on System.getProperty('java.home').
- is duplicated by
-
JENKINS-38911 Incorrect JDK tool version used for builds after new tool added
-
- Resolved
-
- is related to
-
JENKINS-755 Default JDK meaning in project options is confusing.
-
- Resolved
-
-
JENKINS-12550 System default JDK wrongly used if JDK is created first
-
- Resolved
-
Looks like I'm reviving this pretty old one but IMHO it's definitely an important one.
I agree with the reporter because I ran into several issues caused by the "default JDK" assumption:
I created a fresh Jenkins (1.573) installation and configured the current JDK 7 (Java SE DK 1.7.0_u65) in Jenkins. Since one cannot select the JDK to use in (e.g.) Maven jobs I was assuming Jenkins would take the 1.7.0_u65 JDK. I also provided a fresh SSH slave node and ran across the following issues. If Java is not installed on the node, Jenkins copies a pretty old 1.6.0_u45 JDK for execution on the node and also correctly provides the specified 1.7.0_65 JDK for the job's builds. Unfortunately the Sonar post build step which was configured to use the same JDK as the job ("Inherit From Job") tried to use plain "java" which was not present on the slave node machine; the job failed. Selecting the 1.7.0_u65 JDK in the Sonar step configuration fixed this.
In a second scenario I installed a JDK on the SSH slave node such that Jenkins would not use the way too old 1.6.0_u45 JDK. Again the job was "configured" (since only one JDK was configured for Jenkins one cannot select which one to use) to use the "default JDK". Unfortunately the "default JDK" on the slave node was 1.7.0_u55 and NOT the 1.7.0_u65 JDK as specified in Jenkins main configuration. And ON TOP OF that, one has to define a second JDK just to be able to configure the job to use the right one (which it does eventually). Also with an actual selection the Sonar step configuration using "Inherit From Job" does what it is supposed to do.
Long story short; TL;DR:
The "default JDK" assumption is error prone and highly misleading. On a side note: I'd also like to see Jenkins use a more up-to-date JRE than 1.6 on SSH slave nodes if they don't have Java installed.