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是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。

解决办法:

    1. 将webroot修改为webapp
    2. 在pom.xml中指定web.xml,如下
            
                maven-war-plugin
                2.6
                
                    webRoot
           webRoot/WEB-INF/web.xml
                
            

 

转载于:https://www.cnblogs.com/sheng-247/p/7793808.html

你可能感兴趣的:(Maven打包web项目报错Error assembling WAR: webxml attribute is required)