Cannot change version of project facet Dynamic Web Module to 2.5.

When using eclipse to create Maven archetype webapp, the project of web app version 2.3 is automatically created. When modifying the dynamic web module to 2.5 through project faces, the error will be reported: cannot change version of project facet dynamic web module to 2.5

Solution steps:

1. Right click Project – > Show In -> Navigator

2. In the. Settings directory, double-click to open the org.eclipse.wst.common.project.facet.core.xml file, change the version of install facet = “JST. Web” from 2.3 to 2.5, and save it

3. Open the web.xml file and replace its contents

Automatically generated content

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
</web-app>

Replace with the following

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

	<display-name>Archetype Created Web Application</display-name>
</web-app>

preservation

4. Right click the item – > Maven -> Update Project… -> OK

So far, the project has been successfully modified to web 2.5

Verification: check the project faces, and the dynamic web module changes to 2.5

Similar Posts: