We're trying to upgrade all our systems to jdk1.8.0_66
, including maven (running on jenkins).
[jenkins@zldinfra1 jvm]$ mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /opt/apache-maven-3.0.5
Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-279.5.2.el6.centos.plus.x86_64", arch: "amd64", family: "unix"
[jenkins@zldinfra1 jvm]$ echo $JAVA_HOME
/opt/java
[jenkins@zldinfra1 jvm]$ file /opt/java
/opt/java: symbolic link to `jdk1.8.0_66'
All a quick google led to is that I should change my JAVA_HOME
to the desired Java version. As you can see above, it's set to jdk1.8.0_66
, but Maven is using a completely different path.
Question:
How do I change maven's JAVA_HOME
?
Edit:
Following @Rottens answer, I manged to get maven running with jdk1.8.0_66
, maven's JAVA_HOME
being set to /opt/jdk1.8.0_66/jre
.
However, I'm still getting the following error upon trying to Deploy (building works fine):
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project deployTest: Fatal error compiling: invalid target release: 1.7
In the POM the compile plugin is set up as follows:
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
In my Jenkins Project config I specified it to use the default
JDK and Maven Version 3.2.1
.
Just noticed:
The Maven Version 3.0.5 (which I configured to use 1.8) does not appear in Jenkins. The Versions that appear in Jenkins are 3.2.1
, 3.1.1
and 3.0.4
.