I am migrating from Maven's jetty plugin to the Cargo plugin (cargo-maven2-plugin) because Cargo will happily run WARs from dependent Maven modules. Within out web-app we have taken great pains to externalize all configuration through JNDI. These JNDI definitions are web-app specific and therefore are placed in a jetty-env.xml file that is outside the WAR. Using the Jetty plugin, we specified this file as follows:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<jettyEnvXml>${basedir}/target/config/jetty-env.xml</jettyEnvXml>
</configuration>
</plugin>
How does one go about specifying this within the Cargo Plugin? Here's the configuration I have so far. It is, of course, failing because of the absent JNDI configuration:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
<configuration>
<deployables>
<deployable>
<groupId>com.mycompany</groupId>
<artifactId>my-war-module</artifactId>
<type>war</type>
<properties>
<context>/</context>
</properties>
</deployable>
</deployables>
</configuration>
<wait>false</wait>
</configuration>
<executions>
......
</executions>
</plugin>
According to CARGO-804, Cargo's Jetty deployer now supports embedding a jetty-env.xml inside your war (as of version 1.0.3).
And in order to keep the jetty-env.xml
outside your "real" war, my suggestion would be to create an additional war module to host the jetty-env.xml
file and configure Cargo to merge WAR files (pay a special attention to the <extensions>true</extensions>
element which is important, as mentioned in CARGO-524).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With