这个问题需要对maven进行配置,找到maven安装目录下的conf目录下的.setting.xml文件,我的目录是E:\JAVA\apache-maven-3.0.4-bin\apache-maven-3.0.4\conf。
如果没有此目录下没有此文件,可能是被隐藏了
按照下图进行勾选,就可以找到.setting.xml
下面进行.setting.xml文件的配置:
找到prifile标签
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.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>
将代码篇中的1.8改为你自己的jdk版本即可
本文介绍如何通过修改Maven的.setting.xml文件来指定项目的JDK版本。具体步骤包括找到Maven安装目录下的conf目录,编辑.setting.xml文件中的profile标签,设置maven.compiler.source, maven.compiler.target等属性。
302

被折叠的 条评论
为什么被折叠?



