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:
- How to Skip testing when Maven is packaged
- Hadoop 3.2.0 idea development environment construction and HDFS read write API operation
- Chinese garbled problem when running. C file in Linux
- How to Uncompress 7z files on Ubuntu, Debian, Fedora
- Git Error Resolution: errno:10054 Time out
- PM2 user defined Log, PID and other Log File Locations
- Sublime text 3 compiles and executes C/C++ programs directly
- Nginx configuration 80 can be accessed by forcing jump 443 or not
- Installation, Configuration and Simple Use of Rancher
- How to Add Dfrours Model
- Linux: Configure Network address through Netplan
- Linux Nagios failed to log in to internal server error (Fixed)
- C#: How to Use Itextsharp to Manipulate PDF Files
- How to Use Apt get Command Under Mac OSX
- Grep: How to Find All the Files Containing a String in Linux
- Solution of device eth0 does not see to be present, delaying initialization. Error in network card under Linux
- Nginx realizes the same background service for portal and business
- linux yum Error: PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org’”
- No devices detected Fatal server error no screens found
- How to set fixed IP address for Raspberry Pie