解決方案引用自:web.xml is missing and <failOnMissingWebXml> is set to trueweb
最近作的一個maven管理的web項目,遇到項目中pom.xml文件報「web.xml is missing and <failOnMissingWebXml> is set to true」的錯誤,錯誤緣由是項目中沒有web.xml文件:
apache
經查詢找到3個解決方案:app
一、生成 web.xml 文件(若是確實不須要web.xml文件,建議跳過此方案,以保持項目代碼的乾淨)webapp
在 Project Explorer 視圖窗口右擊項目的「Deployment Descriptor」項;maven
選擇「Generate Deployment Descriptor Stub」;ide
而後就在「src/main/webapp/WEB-INF」目錄下建立web.xml文件ui
二、在 pom.xml 文件中加入以下配置:
spa
<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>
三、在 pom.xml 文件中加入以下配置(短配置,與版本無關):
orm
<properties> <failOnMissingWebXml>false</failOnMissingWebXml> </properties>