解决办法一 在settings.xml文件中指定jdk版本

既可以修改全局的settings.xml文件(C:\Program Files\apache-maven-3.6.0\conf\settings.xml)

也可以修改用户的settings.xml文件(~\.m2\settings.xml)

在settings.xml文件中找到<profiles>标签,在里面新建一个字标签<profile> 在里面指定jdk版本

我的jdk版本是11 所以写的是11根据你自己的jdk版本写 1.7/1.8~~~~ 

<profile> 
     <id>jdk-11</id> 
     <activation> 
         <activeByDefault>true</activeByDefault> 
         <jdk>11</jdk> 
     </activation>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>11</maven.compiler.source> 
         <maven.compiler.target>11</maven.compiler.target>  
     </properties>  
	</profile>

  

posted on 2020-01-13 15:58  梦昂  阅读(385)  评论(0)    收藏  举报