Updating Plugin framework to support Java11?

86 views
Skip to first unread message

Bryan Stopp

unread,
May 27, 2021, 2:01:50 PM5/27/21
to Jenkins Developers

Was looking at updating my plugin to only build using Java11 and output Java11 bytecode.

But when I went to use 11 as the value of java.level in my pom, it broke due to the plugins not understanding Java target of "1.11" (because its supposed to be just "11").

Is there a plan to update/release a plugin parent pom that is predominantly configured to support only Java11?

Thanks,

-Bryan

Ullrich Hafner

unread,
May 27, 2021, 2:36:29 PM5/27/21
to Jenkins Developers
You should not switch your plugin to Java 11 unless Jenkins core switches to Java 11. Otherwise your plugin will not work in Jenkins instances that run with Java 8. So do not expect a solution until that step has been announced. 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/55720f8e-4944-49e1-ae8a-bc00d34fc50cn%40googlegroups.com.

Ivan Fernandez Calvo

unread,
May 29, 2021, 6:50:25 AM5/29/21
to Jenkins Developers
Hi Bryan,

I have recently the same issue with a plugin I am developing, some of the libraries I use do not support Java 8 anymore so the plugin will work only on Jenkins instances running on JDK 11+. The change of the java.level to 11 will not work directly you have to overwrite some of the configurations that the parent pom made, this is the build config changes you will need.

<properties>
...
<java.level>11</java.level>
</properties>

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>${java.level}</source>
        <target>${java.level}</target>
        <testSource>${java.level}</testSource>
        <testTarget>${java.level}</testTarget>
      </configuration>
    </plugin>
    <!-- https://github.com/mojohaus/animal-sniffer/issues/62 after Java 9 the there is no signatures with animal sniffer, the recommended way is to use releases with the maven-compiler-plugin -->
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>animal-sniffer-maven-plugin</artifactId>
      <configuration>
        <signature>
          <groupId>org.codehaus.mojo.signature</groupId>
          <artifactId>java18</artifactId>
        </signature>
      </configuration>
    </plugin>
  </plugins>
</build>

Oleg Nenashev

unread,
May 29, 2021, 12:06:48 PM5/29/21
to Jenkins Developers
For the Plugin POM, https://github.com/jenkinsci/plugin-pom/pull/133 needs to be finalized and landed. I did not proceed with it 2 years ago, because Java 11 only plugins sounded very undesirable for the Jenkins ecosystem at that point. In 2021 I do not have objections about finalizing and landing this pull request

> You should not switch your plugin to Java 11 unless Jenkins core switches to Java 11. Otherwise your plugin will not work in Jenkins instances that run with Java 8. So do not expect a solution until that step has been announced. 

The solution is mostly there.  We have added support for Java 11+ plugins when working on support for Java 11 in 2018-2019. All recent Jenkins core versions will process the java version support metadata and show warnings if a plugin is not compatible with the controller's Java version. It should be formally supported since 2.164 or so.
Reply all
Reply to author
Forward
0 new messages