一、web.xml is missing and <failOnMissingWebXml> is set to true
原因是在項目中缺少web.xml,且<failOnMissingWebXml>被設置成了true
解決方法:a.如果項目需要web.xml,去復制一個web.xml到項目中即可。
也可以使用Eclipse生成:有如下兩種方式
1.右擊項目——>Java EE Tools——>Generate Deployment Descriptor Stub.然后系統會在src/main/webapp/WEB_INF文件加下創建web.xml文件。錯誤解決!
2.右擊項目——>Properties——>Project Facets 將Dynamic Web Module的勾去掉,點擊Apply,再重新勾上,點擊下方出現的Further configuration availber,再選擇生成的目錄即可生成web.xml
b.如果項目不需要web.xml,則需要在pom.xml中將<failOnMissingWebXml>配置成false,有如下兩種配置方式
1.
<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>
2.
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>