Cannot change version of project facet Dynamic web 3.1 解决方法

1.使用eclipse创建maven项目时,在project facets 中想将Dynamic Web Module版本号改成3.1,报错如下

2.解决方法如下:

2.1.首先打开web.xml,将内容替换如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
    version="3.1">
    <display-name>Archetype Created Web Application</display-name>
</web-app>
2.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.3.在pom.xml文件中<build>节点中增加如下内容:

<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>
3.3.右键项目使用maven_update,就ok啦




猜你喜欢

转载自blog.csdn.net/white_ice/article/details/79096591