Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38911

Incorrect JDK tool version used for builds after new tool added

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • core
    • Jenkins official Docker image, 2.19.1

      I'm running Jenkins 2.19.1 on Docker using your official image. Bundled Java version is 1.8.0_102.

      Steps to reproduce:

      • Configure a single JDK tool in a different version (to easily be able to tell the JDKs used apart). In my case, 1.8.0_101.
      • Create a project (in my case a Freestyle project running Gradle). Since there is just a single JDK tool, there is no option to choose the JDK for the project, the sole configured one is used.
      • Build and make sure the JDK used is correct (in my case, I have a Gradle step calling './gradlew --version', and it showed JDK to be 1.8.1_101, the correct one.
      • Go to tools configuration and configure one more JDK.
      • Start the job again - in my case, it used the system JDK, i.e. 1.8.0_102, i.e. a wrong one.
      • Go to the project configuration - now the JDK list appears and there are 3 options ('(System)', and the two I configured). '(System)' is chosen by default.

      Of course, in this case the JDK change is not dramatic, it should all work. However, I could imagine Jenkins running on Java 7 (i.e. 'system' is JDK 7), and a project using a single JDK tool being JDK 8 - in this case, after the above steps, the project will very likely break by not compiling.

      Expected behavior:

      • After configuring the second JDK tool, there are only two options to choose from in the JDK list, the 'system' JDK does not appear as it is not configured in the tool configuration page.
      • The automatically chosen JDK tool is preserved when new JDK tools are added.

      I actually think this issue may only occur in the above scenario, i.e. when there is initially only one custom JDK, since for > 1 tools there is a JDK list to choose from and the user choice is explicit, contrary to the implicit one with only one configured tool.

            Unassigned Unassigned
            wujek_srujek wujek srujek
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: