When you create a project using MAVEN, there are sometimes failonmissingwebxml errors in the Pom.xml War where the error message is: Web. XML is missing and <failOnMissingWebXml> is set to true;
The reason for this is that the Web. xml file must be added to the MAVEN project, however, the XML file has become dispensable in the recent application development. However, Maven has not yet followed this change, so we have two ways to solve this problem:
Method One:
If there is no web. XML in the project, add a Web. XML to the project, refresh the project, there should be no error, if your project has Web. XML under/src/main/webapp/web-inf, but still report the error, it takes two steps:
1) Right-click the project, open the Properties dialog, click the Deployment assembly option, add a folder to the right, and save the settings
2) Click Project->clean above Eclispe to clean up this project
The Web. Xml reads as follows:
<?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 "xmlns:web=" http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd "
xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id= "webapp_id" version= "2.5" >
<welcome-file-list>
<welcome-file>index.html</ welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</ welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm </welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list >
</web-app>
However, the method does not seem to solve the problem, so continue to look down.
Method Two:
Just deal with the problem of <failOnMissingWebXml>false</failOnMissingWebXml> being set to false. That is, add the following configuration to the Pom.xml:
<build>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins</groupid >
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
< configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
As shown in figure:
The problem has been resolved. The advantage of this is that we do not have to be a useless web. xml file in the project life. There is no problem with the missing Web. xml file in maven where the update version (from which version I do not know ~ ~) already exists.