<plugins><!--eclipse maven update jdk的修改写死-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
C:\Users\name>mvn -version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
Maven home: E:\Program Files (x86)\Maven\apache-maven-3.5.2\bin\..
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: E:\Program Files (x86)\Java\jdk1.8.0_151\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
其中Java version: 1.8.0_151, 就是MVN运行的jdk版本,是从如下地方来的
1.从系统变量、环境变量JAVA_HOME而来(高优先级)
2.如果没有JAVA_HOME变量则从path路径中找java.exe的版本
如果两者都没有
C:\Users\name>mvn -version
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE