Fatal error compiling: invalid target release: 1.7 -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project bugkillers-core: Fatal error compiling: invalid target release: 1.7 -> [Help 1]
[ERROR]
How to Fix
1. mvn -v displays the following results.
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
Maven home: /usr/share/java/apache-maven-3.2.5
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
2. Pom Settings are as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
3. But the java-version result is as follows:
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
4. 1.7 is not used for compilation, and Maven’s Java Home is set to 1.7 (multiple versions of the JDK are set locally)
Modify maven’s configuration. Java_home points to 1.7,/etc/mavenrc, and ~/.mavenRC. Two files do not exist by default, you need to create, you can choose one
For example: vi ~/.mavenrc
Writing:
JAVA_HOME=`/usr/libexec/java_home -v 1.7`
5. Then mVN-V, the results are as follows:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
Maven home: /usr/share/java/apache-maven-3.2.5
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.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"
Done
Read More:
- Ffmpeg about Avio_alloc_Context application for memory release
- Error in compiling Android AOSP by Ubantu [How to Solve]
- [Solved] Error in OpenSSL when compiling code locally for raspberry pie
- [Solved] Error in invoking target ‘agent nmhs‘ of makefile
- ERROR: Invalid subnet : invalid CIDR address: [How to Fix]
- [Solved] make menuconfig Error: recipe for target ‘menuconfig‘ failed
- [Solved] Fatal error: GLOG/logging. H: there is no such file or directory
- [Solved] fatal error: cannot write PCH file: required memory segment unavailable
- Linux Use dtc generate dtb Error: “FATAL ERROR: Unable to parse input tree“
- [Solved] c++: fatal error: Killed signal terminated program cc1plus
- [Solved] C++: fatal error: Killed signal terminated program cc1plus
- Git Clone Error: ‘fatal: HTTP request failed‘
- [Solved] Fatal error LNK1169: one or more multiple defined symbols were found
- [Solved] Denseflow Install Error: fatal error: opencv2/cudaarithm.hpp: No such file or directory
- [Solved] fatal error: linux/videodev.h: No such file or directory
- [Solved] Centos error: collect2: fatal error: cannot find ‘ld‘
- Ubuntu: How to deal with the fatal: the remote end hung up unexpected error of GIT clone Android kernel
- [Solved] fatal error: openssl/hmac.h: No such file or directory
- [Solved] FATAL CONFIG FILE ERROR: Bad directive or wrong number of arguments
- [Solved] pxp_lib.h:19:10: fatal error: linux/pxp_device.h: No such file or directory