Jenkins-Maven builds are failing after Jenkins upgrade version 2.332.3

Hi Team,

Maven builds (JDK 8) are failing with the below error after upgrading to Jenkins(JDK 11) version 2.332.3.

I had already installed JDK 8, JDK11(mandatory for Jenkins version 2.332.3) on the Jenkins server.
Also, Configured both JDK with label JDK8 and JDK 11 on Global tools Config.

While running Maven Project Build, I chooses JDK 8 for build but I am getting below error…

Error:
C:\Program Files\Java\jdk1.8.0_91/bin/java” -cp D:\data\sl16vmhg-jenkins-slave\maven35-agent.jar;D:\data\sl16vmhg-jenkins-slave\tools\hudson.tasks.Maven_MavenInstallation\maven-3.5.2\boot\plexus-classworlds-2.5.2.jar;D:\data\sl16vmhg-jenkins-slave\tools\hudson.tasks.Maven_MavenInstallation\maven-3.5.2/conf/logging jenkins.maven3.agent.Maven35Main D:\data\sl16vmhg-jenkins-slave\tools\hudson.tasks.Maven_MavenInstallation\maven-3.5.2 D:\data\sl16vmhg-jenkins-slave\slave.jar D:\data\sl16vmhg-jenkins-slave\maven35-interceptor.jar D:\data\sl16vmhg-jenkins-slave\maven3-interceptor-commons.jar 54939

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

I had also tried to use JDK11, then I am getting the compilation error due to JDK11 as our code in JDK8.

ERROR:
C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot/bin/java” -cp D:\data\sl16vmhg-jenkins-slave\maven35-agent.jar;D:\data\sl16vmhg-jenkins-slave\tools\hudson.tasks.Maven_MavenInstallation\maven-3.5.2\boot\plexus-classworlds-2.5.2.jar;D:\data\sl16vmhg-jenkins-slave\tools\hudson.tasks.Maven_MavenInstallation\maven-3.5.2/conf/logging jenkins.maven3.agent.Maven35Main D:\data\sl16vmhg-jenkins-slave\tools\hudson.tasks.Maven_MavenInstallation\maven-3.5.2 D:\data\sl16vmhg-jenkins-slave\slave.jar D:\data\sl16vmhg-jenkins-slave\maven35-interceptor.jar D:\data\sl16vmhg-jenkins-slave\maven3-interceptor-commons.jar 54942

**[ERROR] COMPILATION ERROR : **
package javax.xml.soap does not exist

I had also tried to override the node properties set as JDK8 on master node and ran maven jobs but failed with the same error.
I would like to use JDK8 for Jenkins Maven project? Please advise.

More details and a link to a very good page that outlines alternatives is included in this previous answer:

The maven job type is not a good choice. You need to transition those jobs to a different job type. Most of them are transitioning to Pipeline job types so that they can continue to build with their preferred JDK no matter which JDK is running the Jenkins controller.

You can read more about why it is not a good choice in the “Risks” section of the maven plugin documentation:

Thanks for the suggestion.
After converting into freesyle project, getting the below error.

Downloading from RedHat-Repo: https://maven.repository.redhat.com/ga/jdk/tools/5.0/tools-5.0.pom Downloading from central: https://repo.maven.apache.org/maven2/jdk/tools/5.0/tools-5.0.pom

fortify-maven-plugin:1.0.13:cloudscan failed.: NullPointerException → [Help 1]

I have already mentioned the plugin in the pom.xml file and I could see jar file in m2directory of the server. Please advise.

I believe that is an issue related to something inside the Maven plugin named fortify-maven-plugin. It is not something that I recognize or can help. You may want to check for a newer version of the fortify-maven-plugin. I don’t see that mentioned as a publicly available maven plugin.

Thanks Mark.
Does Jenkins Free style project support Dynamic parent pom version?
I am getting an error in my child pom where the value of “REVISION” is not populating
Failed to build parent project for com.XX.XXX:master-platform:war:2.4.${REVISION}

Worked fine in maven project.

I doubt that it supports anything specific to maven projects, though the maven step inside a freestyle project may have some things where it helps.

The documentation for the maven integration plugin warns:

There are multiple ways to build a Maven project with Jenkins:

  • Use a free-style project with a Maven build step
  • Use a Maven-style project
  • Use a Pipeline project with a shell, batch, or powershell build step that calls Maven

The first way runs the build as Maven intended. The second way adds a whole lot of hooks and can even modify the build in ways that Maven did not intend.

The first way requires that you configure stuff yourself. The second way tries to “guess” what you want and auto-configure it.

The first way is initially less user friendly, i.e. you have more UI to click through to get the full set of reports. The second way is initially more user friendly… but when things go wrong… well sorry out of luck.

If something goes wrong with the first way, worst case you add a shell build step above the Maven build step that just runs SET, trigger a build, login to the build agent, switch to the user the build is running as, apply the environment your SET build step output and then run the Maven command that the build’s console log captured. That will give you an exact reproduction of the Maven build and you can debug why your build is not working. When something goes wrong with the second way, well good luck. By all means try to do the same as you would for a freestyle project, but at the end of the day, there is no way you can replicate the injected hooks that Jenkins puts into your Maven build. You can get an approximate reproduction, and hey, that may just be enough to let you figure out what is wrong and fix your build… but there are cases where you cannot.

I suspect that there is a way from the maven command line to perform the operation that you want. Use the maven command line to perform that task and freestyle or Pipeline will work for you.