Where does Cargo generate the XML context for Jetty 6.x?

I am trying to implement the solution mentioned in How to specify the jetty-env.xml file for the Maven Cargo plugin for Jetty?

However, I came across something even more fundamental: My Cargo simply does not generate any xml context.

<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 main idea is that we provide a custom context.xml to replace the created one. However, when I try, I cannot find any XML context generated by Cargo (note that I noticed user configuration files, and with load.jetty.createContextXml - true)

I'm not sure if this is my setup problem, causing a non-generated context, or the context is generated somewhere that I forgot. I checked at target / cargo / and temp directory that the load expanded my WAR, not a single place contains an xml context.

(I am using Maven 2.2.1, Cargo 1.2.1, JDK 6)

+1
maven-2 jetty cargo maven-cargo
source share
1 answer

I'm not 100% sure what your problem is, but here is what the load does for my system for Jetty6.

The directory in which the Jetty installation does NOT contain a runtime context and webapp files. In my case, they are stored in the Java temp directory (i.e. java.io.tmpdir ). On my Ubuntu system, this is /tmp . There is a cargo/conf directory in this directory. In /tmp/cargo/conf , I have a context directory in which the context.xml file is stored, although the actual file name is never context.xml always called the context name of the web application.

In my case, this file is given the same name as the context with which I configured the load. Your problem may arise here because I noticed that you did not provide a context like me:

 <deployables> <deployable> <properties> <!-- Web root context URL --> <context>${build.appserver.context}</context> </properties> </deployable> </deployables> 

Secondly, I also noticed that you commented on the section that places the context.xml file in the right place. If you do not uncomment it, it will not work.

Third, did you set the value of the ${jetty6.context} Maven property?

Fourth, I think you will need to use the standalone Jetty configuration for this. This should not be a problem, as Cargo will automatically download and install it for you. See My configuration here:

  <container> <containerId>jetty6x</containerId> <!-- Using Jetty for build portability so type != "remote". For Jetty would prefer type = "embedded" but we must go with "installed" because jetty-env.xml file would be ignored. See http://jira.codehaus.org/browse/CARGO-861 --> <type>installed</type> <zipUrlInstaller> <url>http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26RC0.zip</url> <installDir>${build.working}</installDir> </zipUrlInstaller> <dependencies> <!-- The following dependencies are added to the servlet container's classpath as if they were installed by a system admin. In order to be included here, they need to be listed as dependencies in this pom.xml. --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc5</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>net.sourceforge.jtds</groupId> <artifactId>jtds</artifactId> </dependency> </dependencies> </container> <!-- Do not hang and wait for a client, just do it --> <wait>false</wait> <configuration> <!-- Deployer configuration --> <!-- Running Jetty container with type=installed (eg local) so type != "runtime", and we are installing it during this execution for the sake of portability so type != "existing" --> <type>standalone</type> <properties> <!-- Use the port number from settings.xml --> <cargo.servlet.port>${build.appserver.port}</cargo.servlet.port> </properties> <deployables> <deployable> <properties> <!-- Web root context URL --> <context>${build.appserver.context}</context> </properties> </deployable> </deployables> <configfiles> <configfile> <file>${basedir}/target/jetty-context.xml</file> <todir>contexts</todir> <tofile>${build.appserver.context}.xml</tofile> </configfile> </configfiles> </configuration> 
0
source share

All Articles