I upgraded my Jenkins from version 2.263.4 to version 2.361.1.
I’ve upgraded my plugins, everything seems healthy now, but while testing my Openshift environment with the Kubernetes plugin, I saw that my java8 docker images got “java.lang.unsupportedclassversionerror” error.
After I read Jenkins requires Java 11 or newer document after 2.361.1 LTS, Java8 agents remoting.jar I saw that you can’t talk to Jenkins via
There are 2 questions I want to ask here;
1- Is there any way to get Java8 agents to talk to Jenkins 2.361.1 LTS? Does anyone really need it but me?
2- I installed jdk11 on my Docker image and it provided a healthy remoting.jar connection. But I have a Maven project and my project needs jdk8. It uses “JAVA_HOME” variable in mvn build processes. Can I change JAVA_HOME when agent is up in Openshift environment? In Pipeline sh “JAVA_HOME=/usr/java/java8” doesn’t work at all.
Yes you can change it once the agent is running. Should be no problem.
In your pipeline you might want to export the JAVA_HOME so it is also set in child processes.
If when you say, “I have a Maven project”, you mean, “I have a Jenkins job definition that uses the maven integration plugin”, then you have a job defined with a Jenkins job type that is strongly coupled to the version of Java running your controller. That’s a bad thing because that means that job type will run with Java 11 while your controller is running Java 11 and then will run with Java 17 when you (eventually) switch your controller to Java 17.
The Jenkins project recommends that users transition from the Maven job type to use Pipeline jobs or freestyle jobs.
An article from CloudBees offers some other alternatives that you may be able to use during your transition from the Maven job type to Pipeline.
There is also a video from Darin Pope that offers ways that Jenkins controllers can provide many different Java versions for use by jobs on those controllers. Those techniques will allow Pipeline jobs and freestyle jobs to use the Java version of their choice while the Jenkins controller runs Java 11 or Java 17. We use those techniques on ci.jenkins.io to build and test with Java 11, Java 17, Java 19, and even Java 8 using Pipeline jobs.