Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add changes after the screenshare with Baptiste

...

Develop and test your plugin for running on Java 11

Jenkins As a part of JEP-211, we request all plugins to remain compatible with Java 8 for now. But you may still need to run the tests with Java 11 so that you can verify the plugin's behavior. It is possible to pass "jvm" and extra Java properties to Maven Surefire plugin to just run tests, but it is easier to actually build & test plugins with JDK 11. Jenkins development tools have been updated to support building and testing with JDK11that:

  1. For non-experimental releases you should always build the plugins with java.level=8. 
    1. As a part of JEP-211, we request all plugins to remain compatible with Java 8 for now
  2. Use plugin-pom:3.29+ (changelog). Versions before 3.29 contain some updates to be able to build and test your plugins using JDK 11
  3. Plugins will be able to compile successfully with JDK 11 if and only if Jenkins Core version (jenkins.version) is above 2.138+
  4. You can update Jenkinsfile to run tests with Java 11. In order to To workaround the Jenkins core requirement, a full configuration matrix may be used in buildPlugin():
    1. Example: Jenkinsfile in the Label Verifier Plugin

...

  • The existing "mvn hpi:run" command will not work correctly on Java 11 unless Java modules are downloaded and passed to the environment (
    Jira
    serverJenkins JIRA
    serverIddd058dce-0c66-3b77-8b09-71b1d7728747
    keyJENKINS-54807
    )
  • If you use Mockito/PowerMock in your plugin tests, you may need to update to the recent versions with Java 11 support 
    • Jira
      serverJenkins JIRA
      serverIddd058dce-0c66-3b77-8b09-71b1d7728747
      keyJENKINS-55098
       tracks adding the versions to Plugin POM dependency management
  • In some cases FindBugs may crash in some cases (
    Jira
    serverJenkins JIRA
    serverIddd058dce-0c66-3b77-8b09-71b1d7728747
    keyJENKINS-53692
    ), workarounds may be needed

See the "Known developer tools issues" for more known issues in Plugin POM and Jenkins plugins.

Release

...

an experimental plugin version specifically for Java 11

Current intermediate solution

First, please avoid doing this.

If you really think you have a case where you need it, we encourage you to come over the Jenkins developers mailing list to expose your case and see if we can find another way.

In any case, the strongly recommended way to handle this is:

...

Although we request all plugins to remain compatible with Java 8, in some cases it may be reasonable to release an experimental version for Java 11 early adopters.

In order to do that, we provide an Experimental Update Center for Java 11. Since Jenkins 2.155, if you run using Jenkins versions with Java 11 preview, Jenkins

...

and Jenkins Docker plugins.txt installer (e.g. "workflow-support:experimental") will default to this experimental update center. It allows Java 11 early adopters to get patches without requiring deploying snapshots manually:

In order to do an experimental release for Java 11, all the following steps must be performed:

Long term solution

The If if you forget about any of the bullets above, the update may impact Java 8 users. The long-term solution is already on its way, but is not delivered yet. It's partly delivered by you bumping to the last 3.29+ parent pom so your plugin embeds a "minimum Java" metadata, plus adapting Jenkins core to use this metadata to filter out releases for a version of Java that is higher than the current runtime. Follow 

Jira
serverJenkins JIRA
serverIddd058dce-0c66-3b77-8b09-71b1d7728747
keyJENKINS-20679
 and 
Jira
serverJenkins JIRA
serverIddd058dce-0c66-3b77-8b09-71b1d7728747
keyJENKINS-55048
 if you are interested.

...