环境:MyEclipse2015 CI+Maven3
使用Maven创建一个Web project(创建方法参考《如何用Maven创建web项目(具体步骤)》),执行maven
install时出现错误。
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.152 s
[INFO] Finished at: 2015-05-19T16:41:50+08:00
[INFO] Final Memory: 9M/21M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.4:war (default-war) on project TestWebApp: 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
原因:目录/src/main/webapp/WEB-INF/下没有web.xml文件;
解决方案:在该目录下新建文件web.xml
效果:成功