問題描述
使用Maven打包項目的時候,出現錯誤:
webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update)
原因分析
web項目下缺少WEB-INF/web.xml
當是在servlet 3.0之后,對於web.xml文件本身是可選的
解決方案
第一種、在pom.xml文件中定義一個參數配置
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
第二種、更新maven-war-plugin的版本
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
</plugin>
第三種、在webapp目錄下創建WEB-INF/web.xml