在项目上右键选择properties,然后点击java build path
jdk版本冲突maven自带版本与eclipse支持版本不同。
修改maven jdk版本在盘符:\apache-maven-3.6.0\conf\setting.xml的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>
在pom.xml中直接写
<properties>
<java.version>1.8</java.version>
</properties>