Dynamic Web Module 选择“3.1”,java选择“1.8”,报错:Cannot change version of project facet Dynamic web module to 3.1,如下图:
解决方法:
1、把servlet修改成3.1,打开maven项目的web.xml, 修改为:
2、修改.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="java" version="1.8"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="3.1"/>
</faceted-project>
3、pom.xml中添加:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
4、Project Facets 重新配置:Dynamic Web Module选择“3.1”,java选择“1.8”
转:https://blog.csdn.net/changjizeng512/article/details/53994504