Spring Boot 2.3.0——以war方式打包失败[webxml attribute is required]解决方案

问题描述

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-cli) on project xihu: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

问题分析

org.apache.maven.plugins:maven-war-plugin:2.2:war插件版本太低

解决方案 

方法一:

在maven中添加插件

配置failOnMissingWebXml为false

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

方法二:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.2.3</version>
</plugin>

 

参考文章 

http://www.520mwx.com/view/93151 

https://blog.csdn.net/vking_wang/article/details/8731824 

https://blog.csdn.net/airainzhe/article/details/78073126

https://blog.csdn.net/spring0832/article/details/105404729

©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页