I am trying to implement the solution mentioned in How to specify jetty-env.xml file for Maven Cargo plugin for Jetty?
However I am facing something even more fundamental: My Cargo is simply not generating any context xml.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
<!-- Configuration to use with the container or the deployer -->
<configuration>
<properties>
<cargo.servlet.port>${itest.webapp.port}</cargo.servlet.port>
<cargo.jetty.createContextXml>true</cargo.jetty.createContextXml>
</properties>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>myApp-web</artifactId>
<type>war</type>
<properties>
<context>/myApp</context>
</properties>
</deployable>
</deployables>
<!--
<configfiles>
<configfile>
<file>${project.build.outputDirectory}/jetty-env.xml</file>
<todir>contexts</todir>
<tofile>${jetty6.context}.xml</tofile>
</configfile>
</configfiles>
-->
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
The basic idea is, we are providing the a custom context.xml to replace the one generated. However, when I am trying out, I cannot find any context XML generated by Cargo (Please note that I have remarked the custom config files, and with cargo.jetty.createContextXml being true)
I am not sure if it is my problem in setting causing the context not generated, or the context is generated somewhere I overlooked. I have checked under target/cargo/ and the temp directory that cargo expanded my WAR, neither place contains the context xml.
(I am using Maven 2.2.1, Cargo 1.2.1, JDK 6)
I am not 100% sure what your problem is, but here is what cargo does on my system for Jetty6.
The directory where the Jetty installation is NOT where the runtime context and webapp files are. In my case, they are stored in the Java temp directory (i.e.
java.io.tmpdir
). On my Ubuntu system this is/tmp
. Under this directory, there is acargo/conf
directory. Under/tmp/cargo/conf
I have a contexts directory where thecontext.xml
file is stored -- although the actual name of the file is nevercontext.xml
it is always named after the web app context.In my case, this file is given the same name as the context I configured cargo with. Herein may lie your problem because I noticed that you did not supply a context as I do:
Secondly, I also noticed you have commented out the section that places the context.xml file in the right place. Unless you uncomment that, this isn't going to work.
Thirdly, did you set the value of the
${jetty6.context}
Maven property?Fourthly - I think for this to work you need to use a standalone configuration of Jetty. This shouldn't be a problem as Cargo will automatically download and install it for you. See my config here: