Maven - Use maven to create a project in Eclipse. The JDK version is 1.5 by default.

Please see the solution:

  1. Modify the settings.xml file of maven.

Add the following line and change the jdk version to the version you need:

<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. Check whether the configuration file is referenced in eclipse. My user settting used the wrong location before.

    Then update setttings.

Insert picture description here
3. Finally select the created project. After the project is updated, the referenced jdk version is automatically refreshed.

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44556968/article/details/109782818