My maven project have a hard dependency on jdk1.7. I have Jenkins(2.89.4) instance which has jdk 1.8. When I try to connect to slave which(specifying jdk 1.7 in this slave config), launch agent is failing with error below
Starting slave process: cd "/jenkins" && /opt/jdk1.7.0_80/bin/java -jar slave.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Slave JVM has terminated. Exit code=1
Launch agent is successful if this slave has JDK 1.8 installed. But, in this case, my maven build is failing as my maven project have a hard dependency on JDK 1.7.
I was wondering if there is a way to specify slave.jar which is compatible with jdk 1.7 in Jenkins instance
Instead of reconfiguring the agent or messing around with the slave.jar, you can configure the job to use a specific version of the JDK.
One way to do that is by using the Jenkins Global Tool Configuration. Here's a basic walkthrough of setting it up with the Oracle JDK:
JDK 1.7)JDK 1.7 from the dropdownNow, when you run your job, it will automatically download, install, and use the 7u80 JDK.
If you already have the JDK installed on the agent (or want to use something other than the Oracle JDK): back in the Global Tool Configuration section, there's an Add Installer button.
:
/opt/jdk1.7.0_80If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With