Q:

How to specify Java system properties for embedded Jetty with cargo-maven2-plugin

I'm trying to use the Maven Cargo plugin to launch an embedded Jetty container for my project's integration tests. The web applications being hosted with Jetty need a Java system property to be passed in pointing to their configuration file. How do I get this to work with Cargo?
I've tried the plugins cargo.jvmargs setting, and it doesn't seem to be working:
<plugin>
    <!-- Launch an embedded Jetty instance hosting this project's WAR (as 
        well as the rps-tourney-service-app WAR it depends on) prior to running this 
        project's integration tests, and stop it after the integration tests. Alternatively, 
        for manual testing, manually run 'mvn cargo:run' to start the Jetty server, 
        and have Cargo wait for a 'ctrl+c' command to stop it. -->
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <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>
    <configuration>
        <container>
            <containerId>jetty9x</containerId>
            <type>embedded</type>
        </container>
        <configuration>
            <properties>
                <cargo.servlet.port>9093</cargo.servlet.port>
                <cargo.jvmargs>-Drps.service.config.path=${project.build.testOutputDirectory}/rps-service-config-its.xml
                    -Drps.webapp.config.path=${project.build.testOutputDirectory}/rps-webapp-config-its.xml</cargo.jvmargs>
            </properties>
        </configuration>
        <deployables>
            <deployable>
                <!-- The web service WAR for the application. -->
                <groupId>com.justdavis.karl.rpstourney</groupId>
                <artifactId>rps-tourney-service-app</artifactId>
                <type>war</type>
                <properties>
                    <context>/rps-tourney-service-app</context>
                </properties>
            </deployable>
            <deployable>
                <!-- The end-user web site WAR for the application. As this is the 
                    current project, Cargo binds the artifact automatically. All that needs to 
                    be done here is to configure the context path. -->
                <properties>
                    <context>/rps-tourney-webapp</context>
                </properties>
            </deployable>
        </deployables>
    </configuration>
</plugin>

The webapps launch as expected, but then die because the expected configuration property is not being found.

A:

Figured it out. I'd been worried that this just wasn't possible for embedded Jetty (or other embedded containers), but it is: I was just passing the system properties incorrectly.
Use the <container><systemProperties><someProp>someVal</someProp></systemProperties></container> option, instead. For example:
<plugin>
    <!-- Launch an embedded Jetty instance hosting this project's WAR (as 
        well as the rps-tourney-service-app WAR it depends on) prior to running this 
        project's integration tests, and stop it after the integration tests. Alternatively, 
        for manual testing, manually run 'mvn cargo:run' to start the Jetty server, 
        and have Cargo wait for a 'ctrl+c' command to stop it. -->
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <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>
    <configuration>
        <container>
            <containerId>jetty9x</containerId>
            <type>embedded</type>
            <!-- This works! -->
            <systemProperties>
                <rps.service.config.path>${project.build.testOutputDirectory}/rps-service-config-its.xml</rps.service.config.path>
                <rps.webapp.config.path>${project.build.testOutputDirectory}/rps-webapp-config-its.xml</rps.webapp.config.path>
            </systemProperties>
        </container>
        <configuration>
            <properties>
                <cargo.servlet.port>9093</cargo.servlet.port>
            </properties>
        </configuration>
        <deployables>
            <deployable>
                <!-- The web service WAR for the application. -->
                <groupId>com.justdavis.karl.rpstourney</groupId>
                <artifactId>rps-tourney-service-app</artifactId>
                <type>war</type>
                <properties>
                    <context>/rps-tourney-service-app</context>
                </properties>
            </deployable>
            <deployable>
                <!-- The end-user web site WAR for the application. As this is the 
                    current project, Cargo binds the artifact automatically. All that needs to 
                    be done here is to configure the context path. -->
                <properties>
                    <context>/rps-tourney-webapp</context>
                </properties>
            </deployable>
        </deployables>
    </configuration>
</plugin>

And things work as expected. Yay!

