【问题标题】:How to override web.xml in jetty-maven-plugin when filtering过滤时如何覆盖jetty-maven-plugin中的web.xml
【发布时间】:2012-08-29 13:37:42
【问题描述】:

我的 web.xml 中有 ${properties},它们根据配置文件进行过滤。我想将 web.xml 与 jetty:run 的最终属性一起使用,但我还没有成功,它总是坚持使用 web.xml 的默认路径,即file:/home/---/Projects/project/trunk/src/main/webapp/WEB-INF/web.xml

我试过了:

    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.1.4.v20120524</version>
        <configuration>
            <webAppConfig>
                <overrideDescriptor>target/project/WEB-INF/web.xml</overrideDescriptor>
            </webAppConfig>
        </configuration>
    </plugin>

    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.1.4.v20120524</version>
        <configuration>
            <overrideWebXml>target/project/WEB-INF/web.xml</overrideWebXml>
        </configuration>
    </plugin>

问题的一部分是知道哪些配置与哪些版本一起使用,因为似乎没有人把它写下来。此外,OverrideDescriptor 仅基于 eclipsepedia 上的文档添加到 Web 上下文配置中。

【问题讨论】:

    标签: jakarta-ee maven jetty war maven-jetty-plugin


    【解决方案1】:

    根据the documentation,配置选项为webXml

    【讨论】:

    • 我以为我也试过了,但现在可以了,谢谢!
    【解决方案2】:

    接受的答案文档链接适用于 Jetty 6,它不适用于 OP 的版本 8.1.4.v20120524

    对于上述版本,使用this:

        <plugins>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.4.v20120524</version>
            <configuration>
              <webApp>
                <descriptor>/path/to/web.xml</descriptor>
              </webApp>
            </configuration>
          </plugin>
        </plugins>
    

    【讨论】:

      猜你喜欢
      • 2013-06-14
      • 1970-01-01
      • 2021-07-24
      • 1970-01-01
      • 2013-10-25
      • 2018-05-24
      • 2016-10-02
      • 1970-01-01
      • 2021-03-31
      相关资源
      最近更新 更多