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 @ 2021-09-29 14:15  至安  阅读(1124)  评论(0编辑  收藏  举报