1.Maven项目pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案
This is a maven error. It says that it is expecting a web.xml file in your project because it is a web application, as indicated by <packaging>war</packaging>
. However, for recent web applications a web.xml file is totally optional. Maven needs to catch up to this convention. Add this to your maven pom.xml
to let maven catch up and you don't need to add a useless web.xml
to your project:
Here are the steps you can follow:
- You can check this by right clicking your project, and open its Properties dialogue, and then "Deployment Assembly", where you can add Folder /src/main/webapp. Save the setting, and then,
- Go to Eclipse menu Project -> Clean... and clean the project, and the error should go away.
or add in “web.xml”
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
as:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>