轉自:http://blog.csdn.net/sinat_22911279/article/details/77454139
提示資訊應該能看懂。也就是缺少了web.xml檔案,<failOnMissingWebXml>被設定成true了。
搜尋了一下,Stack Overflow上的答案解決了問題,分享一下。
目前被頂次數最多的回答原文如下:
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:
大意是說這是一個Maven錯誤,在最近的web應用開發中web.xml檔案已經變得可有可無了。不過Maven還沒有跟上這一變化,我們隻要在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>
“告知”maven即可。這樣做的好處是我們不必在項目生中成一個無用的web.xml檔案。在更新版本(具體從哪一個版本開始我也不知道~~)的maven中已經不存在web.xml檔案缺失的問題,我們隻需要處理<failOnMissingWebXml>被設定成tue的問題即可。也就是在pom.xml中添加如下配置即可。
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>