[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (DEFAULT-COMPILE) on Project API: Fatal error Compiling:invalid Target release:1.7-[Help 1]
invalid target release: 1.7
the target version is invalid based on the error prompt.
View Pom.xml File
<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</ version> <configuration> <source>1.7</source> <target>1.7</target > </configuration> </plugin>
The target version can be seen according to maven-compiler-plugin
the configuration is JDK 1.7;
View JDK version
? ~ Java-versionjava Version "1.7.0_71" Java (tm) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot (tm) 64-bit Ser Ver VM (build 24.71-b01, Mixed mode)
According to the above information can be seen my JDK version is also 1.7;
So where's the problem?
View maven Information
? ~ mvn-vapache maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15t01:37:52+08:00) maven home:/usr/ Local/cellar/maven/3.2.1/libexecjava version:1.7.0_71, Vendor:oracle Corporationjava home:/System/Library/Java/ Javavirtualmachines/1.6.0.jdk/contents/homedefault LOCALE:ZH_CN, platform Encoding:utf-8os name: "Mac OS X", Version: " 10.10 ", Arch:" X86_64 ", Family:" Mac "
Finally I really want to, originally Maven refers to the 1.6 version, then how to modify the configuration to 1.7 version?
Originally, Maven read two configuration files, /etc/mavenrc
and ~/.mavenrc
. Two files default is not, you can choose one to make changes, I choose my user directory ~/.mavenrc
, the following code to write.
Java_home= '/usr/libexec/java_home '
If you have more than one version of the JDK installed on your Mac and you don't want to change the default JDK version, you just need to add a version number to the configuration, such as:
Java_home= '/usr/libexec/java_home-v 1.7 '
/usr/libexec/java_home
A connection file that is represented in the Mac java_home
.
? ~ ll/usr/libexec/java_homelrwxr-xr-x 1 root wheel 79B/16:39/usr/libexec/java_home System/library/frameworks/javavm.framework/versions/current/commands/java_home
Then in the execution
? ~ mvn-vapache maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15t01:37:52+08:00) maven home:/usr/ Local/cellar/maven/3.2.1/libexecjava version:1.7.0_71, Vendor:oracle Corporationjava home:/Library/Java/ Javavirtualmachines/jdk1.7.0_71.jdk/contents/home/jredefault LOCALE:ZH_CN, platform Encoding:utf-8os name: "Mac OS X" , Version: "10.10", Arch: "X86_64", Family: "Mac"
Then there is no such error in the Install project.
How Mac changes the Java version of Maven