最近在做项目时,遇到这样的问题,每次刷新maven后,项目的jdk版本就会变化,可以通过图2和图3的方式临时更改jdk版本,但是下次刷新maven后仍然还是变化,没解决根本问题,可以更改maven配置文件。
![](https://img-blog.csdnimg.cn/3cdac228b97a4a3bacb7bc105dc48b17.png)
![](https://img-blog.csdnimg.cn/a94e5e59494f4e8180c7a3b4b7dc2174.png)
![](https://img-blog.csdnimg.cn/ab4e07301a204f9bb9b1833cb7ea1bc4.png)
解决办法:
更改maven-conf中的setttings.xml配置文件。
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>