I can't seem to be able to get Maven to use Java 1.8. Using 1.8 as the target turns up the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project csaro: Fatal error compiling: invalid target
release: 1.8 -> [Help 1]
The cause of the error is obvious enough: Maven isn't using the right version of Java:
$ mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T07:51:42-06:00)
Maven home: /usr/local/Cellar/maven/3.2.2/libexec
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
But the installed version of Java should be 1.8:
$ java -version
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b22)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b21, mixed mode)
And JAVA_HOME is set:
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
I also tried the command here (which creates mavenrc
). I've tried restarting the computer several times, and have verified that the env var is correctly set (it's set in .bash_profile
).
Maven was installed with Homebrew.
Java 1.8 is working fine in Eclipse (which is using m2e). I just can't get Maven to work on the command line.