How to override web.xml in jetty-maven-plugin when filtering
-
30-06-2021 - |
题
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.
解决方案
According to the documentation, the configuration option is webXml
.
其他提示
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>
不隶属于 StackOverflow