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
在这里插入图片描述

posted @ 2020-09-05 19:35  潇湘客2  阅读(7929)  评论(0编辑  收藏  举报