• Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • core, m2release-plugin
    • None
    • Issue encountered on "cloudbees"

      For some reasons, I need to compile my code with JDK 1.5. I configured a Hudson job with this version and I also configured the maven enforcer plugin to check if the proper JDK is used.

      When I do a release I get this error, obviously I don't use during release the JDK configured for the job :

      FO] [INFO] [enforcer:enforce

      {execution: enforce-versions}

      ]
      [INFO] [DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireJavaVersion
      [INFO] [DEBUG] Rule org.apache.maven.plugins.enforcer.RequireJavaVersion is cacheable.
      [INFO] [DEBUG] Detected Java String: 1.6.0_20
      [INFO] [DEBUG] Normalized Java String: 1.6.0-20
      [INFO] [DEBUG] Parsed Version: Major: 1 Minor: 6 Incremental: 0 Build: 20 Qualifier: null
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [ERROR] BUILD ERROR
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [INFO] org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
      [INFO] Detected JDK Version: 1.6.0-20 is not in the allowed range [1.5,1.6).
      [INFO]
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [DEBUG] Trace
      [INFO] org.apache.maven.lifecycle.LifecycleExecutionException: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
      [INFO] Detected JDK Version: 1.6.0-20 is not in the allowed range [1.5,1.6).

          [JENKINS-7886] Use the JDK configured for the job

          James Nord added a comment -

          James Nord added a comment - see also http://jenkins.361315.n4.nabble.com/Can-Jenkins-set-JAVA-HOME-td3432884.html

          James Nord added a comment -

          I can not reproduce this on Windows or Linux.

          Without more information I will close the bug as can not reproduce.

          James Nord added a comment - I can not reproduce this on Windows or Linux. Without more information I will close the bug as can not reproduce.

          James Nord added a comment -

          If this is still happening please ask cloudbees to contact me so I can get access to debug this.

          James Nord added a comment - If this is still happening please ask cloudbees to contact me so I can get access to debug this.

          I have configured a project to use 32 bits JDK and default for all other project is 64 bits JDK. I also use two build nodes to build my projects. It works fine do a regular build, but once I do a "Perform Maven Release" jenkins select the default 64 bits JDK instead of the configured 32 bits, which is configured in jenkins-slave.xml

          Jenkins: 1.447.1
          Jenkins Maven Release Plug-in Plug-in: 0.9.1

          Christer Wikman added a comment - I have configured a project to use 32 bits JDK and default for all other project is 64 bits JDK. I also use two build nodes to build my projects. It works fine do a regular build, but once I do a "Perform Maven Release" jenkins select the default 64 bits JDK instead of the configured 32 bits, which is configured in jenkins-slave.xml Jenkins: 1.447.1 Jenkins Maven Release Plug-in Plug-in: 0.9.1

          James Nord added a comment -

          The JDK is picked up from the job configuration not the slave.

          If you are just using "default" JDK and have not configured jenkins with multiple JDKs (but just setting env vars in the slave config) then this is not supported - and anything that runs will likely use the platform JDK whenever Maven forks (this is not just the maven release plugin but potentially also surefire tests depending on how this is configured to run).

          see http://my.safaribooksonline.com/book/software-engineering-and-development/ide/9781449311155/configuring-your-jenkins-server/sect-configuration-jdks for details.

          If this is the case can you close the defect and update your config, otherwise can you supply more details please as I have been unable to reproduce this with multiple configured JDKs and Windows/Linux.

          James Nord added a comment - The JDK is picked up from the job configuration not the slave. If you are just using "default" JDK and have not configured jenkins with multiple JDKs (but just setting env vars in the slave config) then this is not supported - and anything that runs will likely use the platform JDK whenever Maven forks (this is not just the maven release plugin but potentially also surefire tests depending on how this is configured to run). see http://my.safaribooksonline.com/book/software-engineering-and-development/ide/9781449311155/configuring-your-jenkins-server/sect-configuration-jdks for details. If this is the case can you close the defect and update your config, otherwise can you supply more details please as I have been unable to reproduce this with multiple configured JDKs and Windows/Linux.

          Christer Wikman added a comment - - edited

          Nope, I have configured several JDKs and the job's configured JDK is not picked up for all goals when you click on "Maven Perfom Release". (But the configured JDK is correctly picked up from when you are click on "Build now"). I studied the log file from "Maven Perform Release" a bit more and it seems that the release goals are using the right JDK (1.6.0_35), but not the verify goal (JDK 1.6.0_30)

          "Maven Perform Release" log extract:
          Executing Maven: -B -f D:/jenkins/workspace/eps-uposadapter-main/product/eps/adapters/uposadapter/main/pom.xml -DdevelopmentVersion=1.0.1-SNAPSHOT -DreleaseVersion=1.0.0 -X -Dresume=false release:prepare release:perform
          Error stacktraces are turned on.
          Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01 0200)
          >>>Java version: 1.6.0_35
          >>>Java home: C:\java32\jdk1.6.0_35\jre (correct JDK as configured in job)
          Default locale: sv_SE, platform encoding: Cp1252
          OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"

          ...

          [DEBUG] Executing: cmd.exe /X /C "D:\jenkins\tools\maven221\bin\mvn.bat -B -X -D maven.repo.local=D:\Work\LocalRepository -P alwaysOn,codesign clean verify"
          [INFO] Error stacktraces are turned on.
          [INFO] Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01 0200)
          >>>[INFO] Java version: 1.6.0_30
          >>>[INFO] Java home: C:\Program Files\Java\jdk1.6.0_30\jre (Invalid JDK, should be c:\java32)
          [INFO] Default locale: sv_SE, platform encoding: Cp1252

          Christer Wikman added a comment - - edited Nope, I have configured several JDKs and the job's configured JDK is not picked up for all goals when you click on "Maven Perfom Release". (But the configured JDK is correctly picked up from when you are click on "Build now"). I studied the log file from "Maven Perform Release" a bit more and it seems that the release goals are using the right JDK (1.6.0_35), but not the verify goal (JDK 1.6.0_30) "Maven Perform Release" log extract: Executing Maven: -B -f D:/jenkins/workspace/eps-uposadapter-main/product/eps/adapters/uposadapter/main/pom.xml -DdevelopmentVersion=1.0.1-SNAPSHOT -DreleaseVersion=1.0.0 -X -Dresume=false release:prepare release:perform Error stacktraces are turned on. Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01 0200) >>>Java version: 1.6.0_35 >>>Java home: C:\java32\jdk1.6.0_35\jre (correct JDK as configured in job) Default locale: sv_SE, platform encoding: Cp1252 OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows" ... [DEBUG] Executing: cmd.exe /X /C "D:\jenkins\tools\maven221\bin\mvn.bat -B -X -D maven.repo.local=D:\Work\LocalRepository -P alwaysOn,codesign clean verify" [INFO] Error stacktraces are turned on. [INFO] Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01 0200) >>> [INFO] Java version: 1.6.0_30 >>> [INFO] Java home: C:\Program Files\Java\jdk1.6.0_30\jre (Invalid JDK, should be c:\java32) [INFO] Default locale: sv_SE, platform encoding: Cp1252

          James Nord added a comment -

          @Christer What version of the maven release plugin do you use?

          can you run a freestyle build on this node and output the result of "set" in a batch script?

          James Nord added a comment - @Christer What version of the maven release plugin do you use? can you run a freestyle build on this node and output the result of "set" in a batch script?

          James Nord added a comment -

          "but once I do a "Perform Maven Release" jenkins select the default 64 bits JDK instead of the configured 32 bits, which is configured in jenkins-slave.xml"

          So you have set JAVA_HOME in the slave environment config as well?

          James Nord added a comment - "but once I do a "Perform Maven Release" jenkins select the default 64 bits JDK instead of the configured 32 bits, which is configured in jenkins-slave.xml" So you have set JAVA_HOME in the slave environment config as well?

          James Nord added a comment -

          and one last thing - What type of slaves are you seeing this issue on?

          e.g.
          Dumb slave launched by jnlp
          or
          Jenkins managed DCOM.

          James Nord added a comment - and one last thing - What type of slaves are you seeing this issue on? e.g. Dumb slave launched by jnlp or Jenkins managed DCOM.

          James Nord added a comment -

          still can not reproduce in my environment and request for more info have not been responded to.

          James Nord added a comment - still can not reproduce in my environment and request for more info have not been responded to.

            Unassigned Unassigned
            pascalleclercq pascalleclercq
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: