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

"JDK 5 not supported with Maven" error with JDK 6

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Trivial
    • Resolution: Fixed
    • Component/s: maven-plugin
    • Labels:
    • Environment:
      jenkins: 1.612
      maven2: 2.2.1
      maven plugin: 2.9
      Ubuntu 14.04.2 LTS
      openjdk-6-6b35-1.13.7
      openjdk-7-7u79-2.5.5
    • Similar Issues:

      Description

      When building a project that uses Maven, an error is encountered that states that Maven and JDK 5 are not compatible. However, the JDK version that was invoked is very obviously Java 6. Worse, the Maven plugin then increments the JDK version to JDK 7, which is also available on the system.

      [main] $ /usr/lib/jvm/java-6-openjdk-amd64//bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.6.jar:/usr/share/maven2/boot/classworlds.jar hudson.maven.agent.Main /usr/share/maven2/ /var/cache/jenkins/war/WEB-INF/lib/remoting-2.51.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.6.jar 56940
      <===[JENKINS REMOTING CAPACITY]===>channel started
      ERROR: JENKINS-18403 JDK 5 not supported to run Maven; retrying with slave Java and setting compile/test properties to point to /usr/lib/jvm/java-6-openjdk-amd64/
      [main] $ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.6.jar:/usr/share/maven2/boot/classworlds.jar hudson.maven.agent.Main /usr/share/maven2/ /var/cache/jenkins/war/WEB-INF/lib/remoting-2.51.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.6.jar 34098

      This is not reproducible from the command line; building a project from the same pom.xml and same maven2 build and same JDK will result in a proper build.

        Attachments

          Issue Links

            Activity

            Hide
            aheritier Arnaud Héritier added a comment -

            New error is

            ERROR: ================================================================================
            ERROR: Invalid project setup: hudson/maven/AbstractMavenProcessFactory$ConfigureOriginalJDK : Unsupported major.minor version 51.0
            ERROR: [JENKINS-18403][JENKINS-28294] JDK 'j6' not supported to run Maven projects.
            ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the master.
            ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.
            ERROR: Retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/.
            ERROR: ================================================================================
            

            Fixed in maven-plugin >= 2.14

            Show
            aheritier Arnaud Héritier added a comment - New error is ERROR: ================================================================================ ERROR: Invalid project setup: hudson/maven/AbstractMavenProcessFactory$ConfigureOriginalJDK : Unsupported major.minor version 51.0 ERROR: [JENKINS-18403][JENKINS-28294] JDK 'j6' not supported to run Maven projects. ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the master. ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK. ERROR: Retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/. ERROR: ================================================================================ Fixed in maven-plugin >= 2.14
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Arnaud Heritier
            Path:
            src/main/java/hudson/maven/AbstractMavenProcessFactory.java
            http://jenkins-ci.org/commit/maven-plugin/81dd5ee4eb76ce1b8f41fde753ca5c46d52cd4be
            Log:
            [fix JENKINS-28294] Improve the ERROR message when a Maven project is launched with a java version < to the minimum version required by the master. (#58)

            Examples:

            • Jenkins >= 1.612 requires Java 7 thus Maven jobs must be launched with Java >= 7
            • Jenkins >= 1.520 requires Java 6 thus Maven jobs must be launched with Java >= 6
            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Arnaud Heritier Path: src/main/java/hudson/maven/AbstractMavenProcessFactory.java http://jenkins-ci.org/commit/maven-plugin/81dd5ee4eb76ce1b8f41fde753ca5c46d52cd4be Log: [fix JENKINS-28294] Improve the ERROR message when a Maven project is launched with a java version < to the minimum version required by the master. (#58) Examples: Jenkins >= 1.612 requires Java 7 thus Maven jobs must be launched with Java >= 7 Jenkins >= 1.520 requires Java 6 thus Maven jobs must be launched with Java >= 6
            Hide
            aheritier Arnaud Héritier added a comment -

            Yes we are agree Robert Zaczynski It is working with FreeStyle or Multi configuration jobs
            The problem is only in Maven Jobs because its "advanced" jenkins/maven integration relies on the exchange of java serialized classes between the jenkins master JVM and the Maven one. Because of this Maven Jobs cannot run on a java version < to the version with which Jenkins core is compiled.
            Thus it is a bug, or a technical limitation ... but not easy to solve
            I tried to document this a little bit on our CloudBees side : https://cloudbees.zendesk.com/hc/en-us/articles/217517477-Maven-jobs-and-Java-versions-compatibility
            Maybe I could just copy it in the Maven Job wiki page but I'm not sure that people will read it more

            Show
            aheritier Arnaud Héritier added a comment - Yes we are agree Robert Zaczynski It is working with FreeStyle or Multi configuration jobs The problem is only in Maven Jobs because its "advanced" jenkins/maven integration relies on the exchange of java serialized classes between the jenkins master JVM and the Maven one. Because of this Maven Jobs cannot run on a java version < to the version with which Jenkins core is compiled. Thus it is a bug, or a technical limitation ... but not easy to solve I tried to document this a little bit on our CloudBees side : https://cloudbees.zendesk.com/hc/en-us/articles/217517477-Maven-jobs-and-Java-versions-compatibility Maybe I could just copy it in the Maven Job wiki page but I'm not sure that people will read it more
            Hide
            rzacz Robert Zaczynski added a comment -

            There is a workaround to this problem. From my experience with Jenkins ver. 1.629 (already on JDK 1.7), it looks like the issue only occurs when you create a new job using ‘Maven project’ template.

            If you create a ‘Freestyle’ or ‘Multi-configuration’ project and configure Maven using ‘Invoke top-level Maven targets’ or ‘Invoke Maven 3’ build step, everything works fine.

            I successfully tested with JDK 1.5 and 1.6 added to the main Jenkins config, which made them available in a JDK drop-down list of the job configuration. Note my Jenkins is running on JDK 1.7.

            Therefore, I believe that the original problem is a Jenkins bug.

            I can’t imagine why Jenkins would’ve prevented use of older JDKs in a project build, provided you can successfully built the project from the command line – it’s a tool after all.
            Java 7 requirement from version 1.612 is a different matter related to running Jenkins itself.

            Show
            rzacz Robert Zaczynski added a comment - There is a workaround to this problem. From my experience with Jenkins ver. 1.629 (already on JDK 1.7), it looks like the issue only occurs when you create a new job using ‘Maven project’ template. If you create a ‘Freestyle’ or ‘Multi-configuration’ project and configure Maven using ‘Invoke top-level Maven targets’ or ‘Invoke Maven 3’ build step, everything works fine. I successfully tested with JDK 1.5 and 1.6 added to the main Jenkins config, which made them available in a JDK drop-down list of the job configuration. Note my Jenkins is running on JDK 1.7. Therefore, I believe that the original problem is a Jenkins bug. I can’t imagine why Jenkins would’ve prevented use of older JDKs in a project build, provided you can successfully built the project from the command line – it’s a tool after all. Java 7 requirement from version 1.612 is a different matter related to running Jenkins itself.
            Hide
            aheritier Arnaud Héritier added a comment -

            Here is the PR for this : https://github.com/jenkinsci/maven-plugin/pull/58

            Based on the discussion here I just updated the error message but not the behavior.

            Before:

            ERROR: [JENKINS-18403] JDK 5 not supported to run Maven; retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
            

            After:

            ERROR: [JENKINS-18403][JENKINS-28294] JDK 'java-1.6' not supported to run Maven projects; retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home. Maven projects have to be launched with a Java version greater or equal to the one used by the slave. Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.
            
            Show
            aheritier Arnaud Héritier added a comment - Here is the PR for this : https://github.com/jenkinsci/maven-plugin/pull/58 Based on the discussion here I just updated the error message but not the behavior. Before: ERROR: [JENKINS-18403] JDK 5 not supported to run Maven; retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home After: ERROR: [JENKINS-18403][JENKINS-28294] JDK 'java-1.6' not supported to run Maven projects; retrying with slave Java and setting compile/test properties to point to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home. Maven projects have to be launched with a Java version greater or equal to the one used by the slave. Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK.

              People

              • Assignee:
                aheritier Arnaud Héritier
                Reporter:
                karlkatzke Karl Katzke
              • Votes:
                23 Vote for this issue
                Watchers:
                31 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: