zoukankan      html  css  js  c++  java
  • Maven打包web项目报错Error assembling WAR: webxml attribute is required

    Maven打包web项目报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 03:09 min
    [INFO] Finished at: 2017-11-06T16:01:05+08:00
    [INFO] Final Memory: 28M/290M
    [INFO] ------------------------------------------------------------------------
    Waiting for Jenkins to finish collecting data
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:war (default-war) on project stuOriginManager: 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
    [JENKINS] Archiving /var/lib/jenkins/workspace/mysite/pom.xml to stuOriginManager/stuOriginManager/1.0-SNAPSHOT/stuOriginManager-1.0-SNAPSHOT.pom
    channel stopped
    Finished: FAILURE  

    原因分析: 
    maven的web项目默认的webroot是在srcmainwebapp。如果在此目录下找不到web.xml就抛出以上的异常。

    解决办法:

      1. 将webroot修改为webapp
      2. 在pom.xml中指定web.xml,如下
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <warSourceDirectory>webRoot</warSourceDirectory>
               <webXml>webRoot/WEB-INF/web.xml</webXml>
                    </configuration>
                </plugin>
  • 相关阅读:
    kernel list 实践
    rpm打包
    void out2() const{
    剑指offer python版 两个链表的第一个公共结点
    剑指offer python版 数组中的逆序对
    剑指offer python版 字符串中第一个只出现一次的字符
    剑指offer python版 丑数 (只含有2,3,5因子)
    剑指offer python版 最长不含重复字符的子字符
    剑指offer python版 礼物的最大价值
    剑指offer python版 数字序列中某一位的数字
  • 原文地址:https://www.cnblogs.com/sheng-247/p/7793808.html
Copyright © 2011-2022 走看看