参考于姓赖的先生
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, 修改为:
<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 3.1//EN""http://java.sun.com/dtd/web-app_3_1.dtd" ><web-app><display-name>Archetype Created Web Application</display-name>
</web-app>
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="jst.web" version="3.1"/><installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
3、pom.xml中添加:
<plugin><groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration><source>1.8</source><target>1.8</target></configuration></plugin>
4、调回原有视图