When I run my Jenkins Maven project, I get the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project myProject: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
This shows that Maven is using Java 1.8 but it is supposed to use Java 1.7.
I run Maven in debug mode and it showed me the right versions:
...
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven305
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: /var/lib/jenkins/tools/hudson.model.JDK/JDK_7u71/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-44-generic", arch: "amd64", family: "unix"
...
The Jenkins server runs with Java 1.8
...
$ java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
...
$ javac -version
javac 1.8.0_74
...
Is there a simple solution to this?