Maven打包web項目報錯:webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update)


問題描述

使用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
在這里插入圖片描述


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM