解决方案引用自:web.xml is missing and <failOnMissingWebXml> is set to true
最近做的一个maven管理的web项目,遇到项目中pom.xml文件报“web.xml is missing and <failOnMissingWebXml> is set to true”的错误,错误原因是项目中没有web.xml文件:
经查询找到3个解决方案:
1、生成 web.xml 文件(如果确实不需要web.xml文件,建议跳过此方案,以保持项目代码的干净)
在 Project Explorer 视图窗口右击项目的“Deployment Descriptor”项;
选择“Generate Deployment Descriptor Stub”;
然后就在“src/main/webapp/WEB-INF”目录下创建web.xml文件
2、在 pom.xml 文件中加入如下配置:
<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>
3、在 pom.xml 文件中加入如下配置(短配置,与版本无关):
<properties> <failOnMissingWebXml>false</failOnMissingWebXml> </properties>
转载于:https://blog.51cto.com/wuyongzhiyi/1927436