新建的maven项目默认jdk版本不匹配
1.在maven的安装目录编辑文件conf/settings.xml文件,找到<profiles></profiles>标签内增加以下内容:
<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>
2.打开eclipse->windows->preferences->Maven->User Settings窗口中选中UserSettings的“Browse”重新选择
刚刚maven安装目录下编辑的settings.xml
3.eclipse重新新建maven项目发现jdk引用的是刚刚配置的1.8版本了
本文介绍了当新建的maven项目默认JDK版本不匹配时的解决方案。首先,在maven的settings.xml文件中添加针对JDK 1.8的profile配置,然后在Eclipse中更新Maven的User Settings,指向修改后的settings.xml文件。通过这些步骤,可以确保新建的maven项目使用配置的JDK 1.8版本。

425

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



