一、新建一个maven项目:
1、pom报错:
2、报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project withmaven3: 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
3、分析:没有web.xml文件。
在网上找了个方法,终于解决了:
http://blog.csdn.net/stemq/article/details/52922790
下面的是复制过来的:
问题现象:
用Maven打包时,报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war错误。
原因分析:
打包时在WebContent/WEB-INF/文件夹下找不到web.xml文件。
解决方案:
如果WebContent/WEB-INF/web.xml文件存在,需要在pom.xml文件的<build>节点中,加上maven-war-plugin插件配置。
如果WebContent/WEB-INF/web.xml文件不存在,则按下面的方式配置。
4、最后:
1、右键项目,然后run as -》maven clear -》maven builder 或者直接:
maven -》 update project 选中
然后就ok了。