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

new maven jobs ignore configured JDK and use default JDK on agent



    • Similar Issues:


      After the yum upgrade of our jenkins server from v 2.176.3 to v 2.277.1 maven jobs will not use the configured JDK, but instead use the default JDK on the slave node. This appears to only effect jobs that are created after the upgrade, as existing jobs continue to use the configured JDK.
      The master and slave nodes are running CentOS Linux release 7.9.2009.
      All relevant plugins were upgraded following the upgrade of jenkins core (current version info is attached), and 3 JDKs are defined for this Jenkins server.

      To investigate this I created a new maven job (maven command = "validate -X") and selected one of the 3 JDKs we have defined for this Jenkins server ('OpenJDK-11.0.7_10').
      If I reopen the job in the configuration editor, the jenkins log will report this error

      Mar 31, 2021 7:52:23 PM WARNING hudson.scm.SubversionSCM getModuleRoot
      No JDK named '["OpenJDK-11.0.7_10",""]' found

      and the JDK field in the UI will show "(System)", although if I directly inspect the config.xml I see this:

      [root@dapajenkin200 jenkins]# cat jobs/smf_new_2/config.xml | grep "<jdk>"

      Note that there is a change in how jenkins saves the jdk in the job configuration. In our other Jenkins server which has not been upgraded yet, the same job specifies the jdk like this

      [root@dapajenkim001 ~]# cat /jenkins/jobs/smf-trunk/config.xml | grep "<jdk>"

       The console output for a run of this job shows that it is not using the specified JDK from under the tools folder on the Jenkins slave node

      [root@dapajenkin201 ~]# ls /jenkins/tools/hudson.model.JDK/
      jdk-8u101 jdk-8u161 OpenJDK-11.0.7_10

       but rather uses the default jdk on the host: 

      Started by user John McCullough
      Running as SYSTEM
      Building remotely on dapajenkin201 in workspace /jenkins/workspace/smf_new_2
      No JDK named '["OpenJDK-11.0.7_10",""]' found
      Checking out a fresh workspace because there's no workspace at /jenkins/workspace/smf_new_2
      Cleaning local Directory .
      Checking out http://svn/reco/services/smf/trunk/smf-trunk at revision '2021-03-31T19:36:36.271 +0000' --quiet
      Using sole credentials Jenkins.SVN/****** (This account is intended to be used only by Jenkins for accessing svn. This limited scope of usage is important when auditing access of svn for troubleshooting.) in realm '*****'
      At revision 359776
      No JDK named '["OpenJDK-11.0.7_10",""]' found
      No JDK named '["OpenJDK-11.0.7_10",""]' found
      Parsing POMs
      using global settings config with name GlobalRecondoMavenSettings.xml
      Replacing all maven server entries not found in credentials list is true
      Downloaded artifact http://papaafrepo001:8081/artifactory/repo/epa/components/service/2021.3.0-SNAPSHOT/maven-metadata.xml
      Downloaded artifact http://papaafrepo001:8081/artifactory/repo/epa/components/2021.3.0-SNAPSHOT/maven-metadata.xml
      Discovered a new module epa.services:smf smf
      Modules changed, recalculating dependency graph
      Established TCP socket on 43153
      maven35-agent.jar already up to date
      maven35-interceptor.jar already up to date
      maven3-interceptor-commons.jar already up to date
      [smf_new_2] $ java -cp /jenkins/maven35-agent.jar:/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3/boot/plexus-classworlds-2.5.2.jar:/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3/conf/logging jenkins.maven3.agent.Maven35Main /jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3 /jenkins/remoting.jar /jenkins/maven35-interceptor.jar /jenkins/maven3-interceptor-commons.jar 43153
      <===[JENKINS REMOTING CAPACITY]===>channel started
      using global settings config with name GlobalMavenSettings.xml
      Replacing all maven server entries not found in credentials list is true
      Executing Maven: -B -f /jenkins/workspace/smf_new_2/pom.xml -gs /tmp/global-settings7600775307120389479.xml validate -X
      [1mApache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)[m
      Maven home: /jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.5.3/apache-maven-3.5.3
      Java version: 1.8.0_282, vendor: Red Hat, Inc.
      Java home: /usr/lib/jvm/java-1.8.0-openjdk-
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "3.10.0-1160.21.1.el7.x86_64", arch: "amd64", family: "unix"

       I did try deleting all 3 JDKs from the Global tool configuration and recreating them and the same behavior is still seen.



          Issue Links



              Unassigned Unassigned
              jmmccullough John McCullough
              0 Vote for this issue
              2 Start watching this issue