I am developing a jenkins plugin for my company and after dropping support for java 8, I updated the plugin and its dependencies to latest versions and everything is working perfectly on my local environment. But when I push latest code to github repo and trigger the jenkins pipeline, it seems that the pipeline uses Java 8 and build is failing. How am I suppose to use make/force the pipeline to use Java 11 or 18, how can I configure it ? Here is the error message. Any help would be greatly appreciated.
Hi @keremozben , is it a public plugin (so we can check the Jenkinsfile and help you) or is it a closed source plugin?
In the screenshot that you are showing, the mvn command reports that it is using JDK8, whcih explains the behavior.
The Maven command line (mvn) selects the JDK to use by looking at the environment variable JAVA_HOME or searching for the binary java in the PATH.
=> These settings depends a lot on “wherwhich Jenkins controller runs this pipeline” : can you explain if it is ci.jenkins.io (the public controller for the CI of Jenkins public plugins) or is it a Jenkins controller in your organization?
If it is the 2nd, then you have to search for the Jenkinsfile of the pipeline to find what kind of agent is used (or if a “Jenkins tool” is used) to determine how is Maven installed and configured.
BTW I would recommend using pull request flow even if you are the sole committer and maintainer, just so that you can check that proposed changes pass CI.