I am using the Jenkins version 2.73-1.1 on a CentOS Linux release 7.3.1611 server.
There are 3 different versions of JDK on the server:
[root @ jenkins java] # ll
total 12
lrwxrwxrwx. 1 root root 16 27 Apr 16.25 default -> / usr / java / latest
drwxr-xr-x. 8 root root 4096 27 Mar 2013 jdk1.6.0_45
drwxr-xr-x. Root root 4096 11 Apr 2015 jdk1.7.0_80
drwxr-xr-x. 9 root root 4096 27 Apr 16.25 jdk1.8.0_131
lrwxrwxrwx. 1 root root 22 27 apr 16.25 latest -> /usr/java/jdk1.8.0_131
As shown in the pictures below, Jenkins is using the jdk1.8.0_131 version and in my project I specified to use JDK7.
When I try to compile my project (mvn clean deploy
), the build fails and I see this ERROR in log:
[Vodafone] $ /usr/java/jdk1.7.0_80/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.11.jar:/opt/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/apache-maven-3.0.4 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.10.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.11.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.11.jar 46349 <===[JENKINS REMOTING CAPACITY]===>channel started ERROR: ================================================================================ ERROR: Invalid project setup: jenkins/security/MasterToSlaveCallable : Unsupported major.minor version 52.0 ERROR: [JENKINS-18403][JENKINS-28294] JDK 'JAVA7' not supported to run Maven projects. ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the master. ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK. ERROR: Retrying with slave Java and setting compile/test properties to point to /usr/java/jdk1.7.0_80. ERROR: ================================================================================ Established TCP socket on 38129 [Vodafone] $ /usr/java/jdk1.8.0_131/jre/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.11.jar:/opt/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/apache-maven-3.0.4 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.10.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.11.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.11.jar 38129 <===[JENKINS REMOTING CAPACITY]===>channel started
Why Jenkins doesn't use jdk 7?