We have updated our Jenkins Version to 2.361.3, after that we couldn't able to run Maven Projects.
We are getting below error.
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
But build is going fine with freestyle project.
After some googling we get to know that the latest jenkins will require to have java 11 to work with maven project, we cannot able to run java 8 projects as maven jobs.
Is there any workaround for this?
Because we have more that 100 maven jobs, which we couldn't easily shift to pipeline or freestyle jobs.
As of Jenkins 2.357, Jenkins requires Java 11 to run. That change was well commmunicated.
If you are using the maven job type, that job type depends on the underlying app's Java, instead of one specified in the JDK tools ( Oracle / Temurin ). That's just one of many issues with its use and why it's been strongly discouraged for years in favour our Freestyle or pipeline jobs.
Your choices are don't upgrade and keep your system at risk, or bite the bullet and convert to Freestyle/Pipeline. Can you use job-dsl or a template and some groovy scripting to convert?
You could also try: Setting the -source and -target of the Java Compiler or using maven toolchains; not sure either will work though.