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

Throttle Concurrent Builds Plug-in 1.9 requires Java7 (it should work with Java6)

      After upgrading from 1.8.4 to 1.9.0, Throttle Concurrent Builds Plug-in started displaying following error:

      FINEST|20230/0|Service jenkins|16-04-15 10:44:35|java.lang.InstantiationException: java.lang.UnsupportedClassVersionError: hudson/plugins/throttleconcurrents/ThrottleMatrixProjectOptions : unsupported classversion 51.0

      We use JDK6 and this plugin does not document that it requires JDK7.

      We use latest required Jenkins core 1.609.3, which does not require JDK7 either.

      The fix could be as simple as regenerate plugin with a JDK6.

          [JENKINS-34272] Throttle Concurrent Builds Plug-in 1.9 requires Java7 (it should work with Java6)

          Fernando Miguelez added a comment - - edited

          I downloaded the sources and tried to generate it locally.

          If found it is not possible to use a JDK6 to compile due to other plugin compatibility:

          [ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:1.117:validate (default-validate) on project throttle-concurrents: Execution default-validate of goal org.jenkins-ci.tools:maven-hpi-plugin:1.117:validate failed: Unable to load the mojo 'validate' in the plugin 'org.jenkins-ci.tools:maven-hpi-plugin:1.117' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/jenkinsci/maven/plugins/hpi/ValidateMojo : unsupported classversion 51.0

          The problem lies in the pom.xml configuration. "compileSource" and "compileTarget" no longer work but "java.level" and "java.level.test". So pom.xml should be updated:

          {{<!--
          <compileSource>1.6</compileSource>
          <compileTarget>1.6</compileTarget>
          -->
          <java.level>6</java.level>
          <java.level.test>6</java.level.test>}}

          There was another issue with xml-apis. It did not compile due to a missing class. I had to force a higher version:

          {{ <dependency>
          <groupId>xml-apis</groupId>
          <artifactId>xml-apis</artifactId>
          <version>1.4.01</version>
          <scope>test</scope>
          </dependency>}}

          And finally one of the classes would now compile due to Java7 syntax:

          [ERROR] /O:/oip/ws/oip/throttle-concurrent-builds-plugin-throttle-concurrents-1.9.0/src/test/java/hudson/plugins/throttleconcurrents/testutils/HtmlUnitHelper.java:[56,46] diamond operator is not supported in -source 1.6

          Just replace following line (65) of HtmlUnitHelper.java :

          List<HtmlButton> res = new ArrayList<>(buttons.size());
          by

          List<HtmlButton> res = new ArrayList<HtmlButton>(buttons.size());

          And it works.

          Fernando Miguelez added a comment - - edited I downloaded the sources and tried to generate it locally. If found it is not possible to use a JDK6 to compile due to other plugin compatibility: [ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:1.117:validate (default-validate) on project throttle-concurrents: Execution default-validate of goal org.jenkins-ci.tools:maven-hpi-plugin:1.117:validate failed: Unable to load the mojo 'validate' in the plugin 'org.jenkins-ci.tools:maven-hpi-plugin:1.117' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/jenkinsci/maven/plugins/hpi/ValidateMojo : unsupported classversion 51.0 The problem lies in the pom.xml configuration. "compileSource" and "compileTarget" no longer work but "java.level" and "java.level.test". So pom.xml should be updated: {{<!-- <compileSource>1.6</compileSource> <compileTarget>1.6</compileTarget> --> <java.level>6</java.level> <java.level.test>6</java.level.test>}} There was another issue with xml-apis. It did not compile due to a missing class. I had to force a higher version: {{ <dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> <version>1.4.01</version> <scope>test</scope> </dependency>}} And finally one of the classes would now compile due to Java7 syntax: [ERROR] /O:/oip/ws/oip/throttle-concurrent-builds-plugin-throttle-concurrents-1.9.0/src/test/java/hudson/plugins/throttleconcurrents/testutils/HtmlUnitHelper.java: [56,46] diamond operator is not supported in -source 1.6 Just replace following line (65) of HtmlUnitHelper.java : List<HtmlButton> res = new ArrayList<>(buttons.size()); by List<HtmlButton> res = new ArrayList<HtmlButton>(buttons.size()); And it works.

          Oleg Nenashev added a comment -

          The plugin's dependency has been upgraded to 1.642.3. Now Java 7 is officially required there

          Oleg Nenashev added a comment - The plugin's dependency has been upgraded to 1.642.3. Now Java 7 is officially required there

            oleg_nenashev Oleg Nenashev
            fmiguelez Fernando Miguelez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: