zoukankan      html  css  js  c++  java
  • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project child02

    maven打包成war时,报错: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project child02: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
    错误原因: 找不到web.xml,但是项目中明明有这个文件,在WebContent/WEB-INF/文件夹下,就是识别不了
    解决方法:
    需要在pom.xml文件中,加上maven-war-plugin插件配置
    在<build>节点中增加:

    <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>WebContent</directory>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>

    如果项目中原本没有web.xml文件,就需要加上下面的配置:

    <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
    </plugins>
  • 相关阅读:
    spring boot 将对象转换为json返回
    Linux 文件创建、插入、替换
    Prometheus + AlertManager 邮件报警
    Prometheus + Grafana 监控 Redis
    虚拟机 vs 容器
    jira,Confluence 的JVM内存优化
    内网MySQL YUM源记录
    atlassian-jira部署文档
    桥接
    http验证
  • 原文地址:https://www.cnblogs.com/mmzs/p/8761417.html
Copyright © 2011-2022 走看看