Upgrading Jenkins Java version from 8 to 11

In order to upgrade the JVM used to run Jenkins, more specifically from Java 8 to Java 11, there are a few details and steps to take care.

If you’re upgrading the JVM used to run Jenkins, and particularly if you’re upgrading from Java 8 to Java 11, there are some details you should know and precautions you should take.

Backup

As with any upgrade, we recommend backing up JENKINS_HOME and testing the upgrade with the backup before performing the upgrade on your production instance.

Upgrading Jenkins

In production environments, you should use only LTS versions of Jenkins. As of February 2019, there are no LTS versions that support Java 11.

If you need to upgrade Jenkins as well as the JVM, we recommand that you:

  1. Back up JENKINS_HOME

  2. Upgrade Jenkins to version 2.164 or higher

    • How you upgrade Jenkins depends on how you installed Jenkins in the first place.

    • We recommend that you use the package manager of your system (such as apt or yum).

  3. Validate the upgrade to confirm that all plugins and jobs are loaded

  4. Upgrade the required plugins (see Upgrading Plugins)

  5. Make a second backup of JENKINS_HOME after upgrading Jenkins and the required plugins

  6. Stop the Jenkins instance

  7. Upgrade the JVM on which Jenkins is running

    • Use a package manager to install the new JVM

    • Make sure the default JVM is the newly installed version. If it is not, use the correct java command in the Jenkins startup scripts (/etc/default/jenkins or /etc/init.d/jenkins)

If you are using Docker containers to run Jenkins, you should follow the same process, and change the Java version by appending -jdk11 to the Docker image tag.

Upgrading Plugins

It’s important to not just upgrade Jenkins and the JVM but also to upgrade the plugins which support Java 11.

The list of plugins that are compatible with Java 11 is on the Known Java 11 Compatibility Issues Wiki page.

If you discover a previously unreported issue, please let us know: see how to report a Java 11 Compatibility issue for guidance.

One of the most important plugin upgrades is the Pipeline: Support plugin: make sure that the version of the plugin is at least 3.0.

Stop all Pipeline jobs before upgrading this plugin, because this upgrade changes the serialization of Pipeline builds. As a general rule,even though Pipeline jobs are supposed to survive a Jenkins restart, it’s always a better option to make sure that no Pipeline builds are in progress before any scheduled Jenkins maintenance.

Javax XML Bind libraries

Some plugins use JAXB libraries provided by the JDK. However, the java.xml.bind and javax.activation modules are no longer included in OpenJDK 11, and plugins might fail if no replacement is offered.

To fix this problem, we’ve bundled those libraries into a new detached plugin: JAXB plugin. When any Jenkins core more recent than 2.163 is running on Java 11, this plugin is automatically installed. However, if you manage your plugins outside Jenkins (for example, if you use plugins.txt in your Docker images), you might need to explicitly install the plugin.

JVM version on agents

All agents must be running on the same JVM version as the master (because of how masters and agents communicate). If you’re upgrading your Jenkins master to run on Java 11, you also need to upgrade the JVM on your agents.

You can validate the version of each agent with the Versions Node Monitors plugin. This plugin provides information about the JVM version of each agent on the node management screen of your Jenkins instance. This plugin can also be configured to automatically disconnect any agent with an incorrect JVM version.

Java Web Start

Java Web Start has been removed in Java 11. When a Jenkins master is running on Java 11, the Java Web Start button will no longer appear in the Web UI. Agents for a Java 11 Jenkins server can’t be launched from a *.jnlp file downloaded to a web browser.

As of February 2019, there are no plans to replace this functionality. Connect agents to Jenkins on Java 11 with plugins like SSH Slaves Plugin, with operating system command line calls to java -jar agent.jar, or by using containers.

JDK Tool Automatic installer

Oracle JDK 11 licensing prevents the Jenkins community from listing the Oracle JDKs. Because of this licensing restriction, Oracle JDK 11 can’t be automatically installed by Jenkins. This problem is tracked in the issue JENKINS-54305.

As an alternative, we encourage you to use containers based on images that contain all the tooling needed for your builds.