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