【问题标题】:web.xml not found during maven build of Tomcat application在 Tomcat 应用程序的 Maven 构建期间找不到 web.xml
【发布时间】:2015-04-28 00:06:09
【问题描述】:

将 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

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

我也对 webapp 和 WebContent 感到困惑。

【问题讨论】:

    标签: mysql maven tomcat openshift


    【解决方案1】:

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

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

    【讨论】:

    • 我有一个功能齐全的 J2EE 应用程序,可以将其导出为 WAR 文件,并且 WebContent 文件夹需要提供 php 支持。在我的测试系统上,我使用从 php Web 根目录到该文件夹​​的符号链接。我不想将我的 J2EE 应用程序更改为特定于 maven,那么在 OpenShift 上部署我的应用程序的最佳方式是什么?
    猜你喜欢
    • 2023-04-10
    • 2020-01-10
    • 1970-01-01
    • 2017-12-28
    • 2018-03-26
    • 2015-07-10
    • 2014-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多