摘要: 本文讲的是Description Resource Path Location Type Java compiler level does not match the version of the in解决方法__jdk, 今天使用maven的时候报这个错误 然后在网上查了,是jdk的版本不匹配, 可以修改如下几个地方
原文地址:https://yq.aliyun.com/ziliao/245790
今天使用maven的时候报这个错误
然后在网上查了,是jdk的版本不匹配,
可以修改如下几个地方
解决方法 1:
我使用的jdk是1.8
windows—proferences—java–compiler设置jdk为1.8
windows—proferences—java–Installed JREs设置jdk为1.8
点击项目右键–properties—java Compiler 设置jdk为1.8
点击项目右键–properties—eclipse—project Facets设置java为1.8
点击项目右键–properties—eclipse—project Facets设置Dynamic Web Module 为3.1(这是你在web.xml配置的servlet版本)
点击项目右键–Maven—update project 错误应该可以消除
如果还是不行你就在pom.xml里面的
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins>
这样就可以解决错误了
解决方法 2:修改安装目录中的..\apache-maven-3.3.9\conf中的settings.xml中修改jdk版本
在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>
如果还是不行就到项目存放的地方我的是F:\eclipse\workspace\seckill.settings修改org.eclipse.wst.common.project.facet.core.xml这个文件
<?xml version="1.0" encoding="UTF-8"?> <faceted-project> <fixed facet="wst.jsdt.web"/> <installed facet="jst.web" version="3.1"/> <installed facet="wst.jsdt.web" version="1.0"/> <installed facet="java" version="1.8"/> </faceted-project>
修改 installed facet=”jst.web” version=”3.1”/为3.1
installed facet=”java” version=”1.8”/>为1.8
这样就OK了