Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override web.xml in jetty-maven-plugin when filtering

I've got ${properties} in my web.xml that are filtered based on profiles. I want to use the web.xml with the final properties with jetty:run but I'm not having success yet, it always sticks with its default path to web.xml, i.e. file:/home/---/Projects/project/trunk/src/main/webapp/WEB-INF/web.xml

I've tried:

    <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>

and

    <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>

Part of the problem is knowing which configs go with which versions because nobody seems to write that down. Also OverrideDescriptor only adds to the web context config, based on the docs on eclipsepedia.

like image 428
Jim Avatar asked Dec 04 '25 12:12

Jim


2 Answers

According to the documentation, the configuration option is webXml.

like image 64
kan Avatar answered Dec 06 '25 16:12

kan


The accepted answer doc link is for Jetty 6, which won't work with the OP's version 8.1.4.v20120524.

For said version, use 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>
like image 44
opyate Avatar answered Dec 06 '25 17:12

opyate



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!