在Tomcat应用程序的maven构建期间找不到web.xml

时间:2015-02-25 19:59:18

标签: mysql maven tomcat openshift

将J2EE应用程序推送到OpenShift Tomcat应用程序时收到以下错误:

remote: [INFO] Webapp assembled in [40 msecs]
remote: [INFO] Building war: /var/lib/openshift/54eb9daa5973ca7b9a0000d9/app-    root/runtime/repo/webapps/ROOT.war
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD FAILURE
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 4.339s
remote: [INFO] Finished at: Wed Feb 25 14:51:14 EST 2015
remote: [INFO] Final Memory: 8M/112M
remote: [INFO] ------------------------------------------------------------------------
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project dragonfly: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
remote: [ERROR] 
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR] 
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我在webapp / WEB-INF / web.xml和.openshift / config / web.xml中有我的web.xml

我也对webapp与WebContent感到困惑。

1 个答案:

答案 0 :(得分:0)

web.xml文件必须放在src/main/webapp/WEB-INF下。您得到的错误是因为Maven没有在此位置找到web.xml

另外,我会猜测,但我认为WebContent是Eclipse在创建Web应用程序时生成的文件夹。如果存在此文件夹,则Eclipse项目配置存在问题。您应该关注Maven conventions整个项目(并使用m2e plugin将Maven性质添加到Eclipse项目中。)