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

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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • maven-plugin
    • 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

      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.

          [JENKINS-28294] "JDK 5 not supported with Maven" error with JDK 6

          Karl Katzke created issue -

          Karl Katzke added a comment -

          I can also reproduce this with maven-project-plugin 2.7.1.

          Karl Katzke added a comment - I can also reproduce this with maven-project-plugin 2.7.1.

          Karl Katzke added a comment -

          I can successfully build the project, with the same POM file, using a "Freestyle Project" – the error above only happens if I am using a "Maven Project"

          Karl Katzke added a comment - I can successfully build the project, with the same POM file, using a "Freestyle Project" – the error above only happens if I am using a "Maven Project"

          Falko Schumann added a comment - - edited

          I can also reproduce this with maven-project-plugin 2.8 and 2.9 using Maven 3.2 and Oracle JDKs.

          Falko Schumann added a comment - - edited I can also reproduce this with maven-project-plugin 2.8 and 2.9 using Maven 3.2 and Oracle JDKs.

          Daniel Beck added a comment - - edited

          Jenkins 1.612 moved to a Java 6 requirement as you can see in the changelog, it's possible this is just the wrong error message with the '5' hard-coded. Since the (mis)design of the Maven Project Plugin results in tight integration between Maven and Jenkins, it wouldn't be surprising if you were now unable to run builds with JDK 6 or earlier with it without additional effort.

          Daniel Beck added a comment - - edited Jenkins 1.612 moved to a Java 6 requirement as you can see in the changelog, it's possible this is just the wrong error message with the '5' hard-coded. Since the (mis)design of the Maven Project Plugin results in tight integration between Maven and Jenkins, it wouldn't be surprising if you were now unable to run builds with JDK 6 or earlier with it without additional effort.

          Karl Katzke added a comment -

          I completely agree with you, Daniel, but it's not the error message – it's the automatic upgrading to JDK 7 that is the bug.

          Karl Katzke added a comment - I completely agree with you, Daniel, but it's not the error message – it's the automatic upgrading to JDK 7 that is the bug.

          Daniel Beck added a comment -

          To clarify, this issue is primarily about the feature that says:

          retrying with slave Java and setting compile/test properties to point to

          ?

          Daniel Beck added a comment - To clarify, this issue is primarily about the feature that says: retrying with slave Java and setting compile/test properties to point to ?

          Karl Katzke added a comment -

          Daniel: The first attempt to build using this JDK:

          /usr/lib/jvm/java-6-openjdk-amd64//bin/java

          Results in an error about JDK5.

          It then results in a build that attempts using this JDK:

          /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java

          This means there are two bugs:

          1. JDK 5 is not allowed, but JDK 6 should be.
          2. When JDK 6 is selected, it should not attempt to build using JDK7, which isn't even configured as an available JDK in Jenkins.

          Karl Katzke added a comment - Daniel: The first attempt to build using this JDK: /usr/lib/jvm/java-6-openjdk-amd64//bin/java Results in an error about JDK5. It then results in a build that attempts using this JDK: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java This means there are two bugs: JDK 5 is not allowed, but JDK 6 should be. When JDK 6 is selected, it should not attempt to build using JDK7, which isn't even configured as an available JDK in Jenkins.

          Daniel Beck added a comment -

          JDK 5 is not allowed, but JDK 6 should be.

          As I wrote, Maven jobs are tightly integrated with Jenkins, and since Jenkins raised the Java runtime requirement to 7, it's possible this was changed as well (and it's just the message that wasn't adjusted to reflect this)

          which isn't even configured as an available JDK in Jenkins

          The message (and code) indicates this is actually a deliberate feature. Not sure what to do about this.

          Daniel Beck added a comment - JDK 5 is not allowed, but JDK 6 should be. As I wrote, Maven jobs are tightly integrated with Jenkins, and since Jenkins raised the Java runtime requirement to 7, it's possible this was changed as well (and it's just the message that wasn't adjusted to reflect this) which isn't even configured as an available JDK in Jenkins The message (and code ) indicates this is actually a deliberate feature. Not sure what to do about this.

          Karl Katzke added a comment -

          I'm not sure, either, but it sure as heck breaks building a Java 6 Maven project with Jenkins. I realize that JDK 6 and JDK 7 are both end of life. But - breaking backwards compatibility like that means that we would need to maintain two completely separate build environments as we start to port our JDK 6 projects to JDK 8 over the next year.

          Karl Katzke added a comment - I'm not sure, either, but it sure as heck breaks building a Java 6 Maven project with Jenkins. I realize that JDK 6 and JDK 7 are both end of life. But - breaking backwards compatibility like that means that we would need to maintain two completely separate build environments as we start to port our JDK 6 projects to JDK 8 over the next year.

            aheritier Arnaud Héritier
            karlkatzke Karl Katzke
            Votes:
            23 Vote for this issue
            Watchers:
            30 Start watching this issue

              Created:
              Updated:
              Resolved: