Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading Jenkins Java version from 8 to 11

Tags:

java

jenkins

I'd like to upgrade java from 8 to 11 as recommended for Jenkins 2.303.1, I'm reading the guide in https://www.jenkins.io/doc/administration/requirements/upgrade-java-guidelines/, but I don't know what to do in step:

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).

does it mean install Java 11 and set java 11 is default one?

like image 718
Tien Dung Tran Avatar asked Apr 12 '26 11:04

Tien Dung Tran


1 Answers

Q4 2023: "Introducing the 2 + 2 + 2 Java support plan "

Jenkins 2.426.1 LTS will support Java 11, 17, and 21.

In Fall 2024, Jenkins will require Java 17 or 21 and drop support for Java 11.
Thereafter, Jenkins will support each Java LTS release for approximately four years; i.e., Jenkins will support two Java LTS releases at any given time.

https://www.jenkins.io/images/post-images/2023/11/06/introducing-2-2-2-java-support-plan-figure1.svg

  • 2023-11-15: Jenkins 2.426.1 LTS will support Java 11, 17, and 21.
  • 2024-11-15: Jenkins LTS will require Java 17 or 21 and drop support for Java 11.

Thereafter, the 2 + 2 + 2 support plan will take effect as described above.


Note: since June 2022, you do not have a choice anymore.

JDK 11 will need to be the one running Jenkins.
It does not have to be the "default" on your system. Only the one selected in the command use to run Jenkins.

Jenkins requires Java 11 (Basil Crow)

Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming September LTS release, Jenkins requires Java 11.

Additionally, beginning with Jenkins 2.355 (released on June 14, 2022) and Jenkins 2.346.1 LTS (released on June 22, 2022), Jenkins supports Java 17.

Plugins have already been prepared in JENKINS-68446.
Use the Plugin Manager to upgrade all plugins before and after upgrading to Jenkins 2.357.

Warning regarding JAXB

Prior to Java 11, Java Architecture for XML Binding (JAXB) was part of the Java Platform, and one could use it without adding a third-party dependency.
Beginning with Java 11, JAXB is no longer a part of the Java Platform and requires adding a third-party dependency.

Thanks to work done several years ago by Baptiste Mathus and others, a JAXB Jenkins plugin is available, which provides the JAXB library to Jenkins plugins in the form of a plugin-to-plugin dependency.

The vast majority of plugins have already been prepared to support Java 11 via the JAXB plugin in JENKINS-68446.
Jenkins users need only upgrade plugins to compatible versions as documented in the Released As field in Jira.

It is critical to use the Plugin Manager to upgrade all plugins before and after upgrading to Jenkins 2.357.
Failure to upgrade plugins to compatible versions may result in ClassNotFoundException, NoClassDefFoundError, or other low-level Java errors.

Upgrade

Docker

The official Jenkins Docker images have been based on Java 11 for many months, with Java 8 available as a fallback and Java 17 available in preview mode.

Beginning with Jenkins 2.357, the Java 8 images will be retired and the Java 17 images will transition from preview to general availability (GA). Users of the official Jenkins Docker images need not install or configure Java on their own, as it comes preinstalled in the image.

OS packages

Users of the official Jenkins OS packages for Debian, Red Hat, and SUSE Linux distributions should note that these packages are agnostic to the Java vendor. > In other words, you must bring your own Java package. One straightforward way to do this is to install Java 11 from your Linux distribution, as described on the package download site

Recommenced Garbage collection options

-XX:+AlwaysPreTouch
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=${PATH}
-XX:+UseG1GC
-XX:+UseStringDeduplication
-XX:+ParallelRefProcEnabled
-XX:+DisableExplicitGC
-XX:+UnlockDiagnosticVMOptions
-XX:+UnlockExperimentalVMOptions
-Xlog:gc*=info,gc+heap=debug,gc+ref*=debug,gc+ergo*=trace,gc+age*=trace:file=${PATH}/gc.log:utctime,pid,level,tags:filecount=2,filesize=100M
-XX:ErrorFile=${PATH}/hs_err_%p.log
-XX:+LogVMOutput
-XX:LogFile=${PATH}/jvm.log

Agents

For best results, it is recommended to run agents with the same version of Java as the version used on the controller.
Use the Versions Node Monitors plugin to verify that agents are running a compatible version of Java.

Running the Jenkins remoting process on an agent with Java 11 or 17 does not imply that you need to run your builds with the same version of Java.
You can continue to use any desired version of Java for individual builds.

like image 88
VonC Avatar answered Apr 15 '26 01:04

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!