Maven -- Eclipse中使用maven创建项目JDK版本默认是1.5解决方法

请看解决方案:

  1. 修改maven的settings.xml文件。

添加以下行,jdk版本改为自己需要的版本:

<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. 在eclipse中检查配置文件是否被引用到,之前我的user settting使用的位置不对。

    然后update setttings。

在这里插入图片描述
3. 最后选择创建的项目,更新项目后,引用的jdk版本自动刷新。

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44556968/article/details/109782818