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>
  • 相关阅读:
    python 类型注解
    python 装饰器
    python 高阶函数、柯里化
    python 生成器函数
    python 递归和匿名函数
    Python 函数返回值、作用域
    Python 练习题总结(待续)
    基于 K8S 集群安装部署 istio-1.2.4
    基于 kubeadm 部署 kubernetes(v1.17.0) 集群
    Gitlab 重置 root 密码
  • 原文地址:https://www.cnblogs.com/mmzs/p/8761417.html
Copyright © 2011-2022 走看看