【问题标题】:maven eclipse wtp not putting custom <webxml> file in WEB-INF foldermaven eclipse wtp 没有将自定义 <webxml> 文件放在 WEB-INF 文件夹中
【发布时间】:2011-12-15 16:34:53
【问题描述】:

当我使用 eclipse wtp 部署 webapp 时,pom.xml 中指定的自定义“webxml”文件不会作为 'web.xml' 复制到 WEB-INF 文件夹。但是该文件在 WEB-INF 文件夹中的战争中被正确复制。

这是来自 pom.xml 的 sn-p

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <webXml>${webXmlPath}</webXml>
        <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
    </configuration>
</plugin>

${webXmlPath} 取决于配置文件并具有默认值:

<properties>
        <webXmlPath>${basedir}/src/main/webapp/WEB-INF/web-embed.xml</webXmlPath>
</properties>

谢谢:)

【问题讨论】:

    标签: maven web.xml eclipse-wtp maven-war-plugin


    【解决方案1】:

    如果您使用m2e-wtp,您的 /.settings/org.eclipse.wst.common.component 应该包含如下条目:

    &lt;wb-resource deploy-path="/WEB-INF/web.xml" source-path="/src/main/webapp/WEB-INF/web-embed.xml"/&gt;

    这应该可以解决问题。

    现在对于支持它的服务器适配器(目前仅 JBoss AS),使用&lt;packagingExcludes&gt;WEB-INF/web.xml&lt;/packagingExcludes&gt; 实际上会阻止 any web.xml 被部署。其他服务器适配器(如 Tomcat)将忽略该指令。

    【讨论】:

    • 这对我有帮助很多。谢谢@Fred!
    猜你喜欢
    • 1970-01-01
    • 2021-08-10
    • 2014-11-12
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-19
    相关资源
    最近更新 更多