美文网首页
Failed to execute goal org.apach

Failed to execute goal org.apach

作者: 带肥肉的羊肉串 | 来源:发表于2018-06-28 16:27 被阅读99次

    转: https://blog.csdn.net/a_bang/article/details/72849483

    使用maven打包时,报错误信息:
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project provider: 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/web.xml文件存在,需要在pom.xml文件中加上maven-war-plugin插件

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

    如果web.xml文件不存在,则按下面的方式配置。

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

    相关文章

      网友评论

          本文标题:Failed to execute goal org.apach

          本文链接:https://www.haomeiwen.com/subject/altnyftx.html