Hi Wendy,
I don't know if this is useful to you but here's attached an example POM of
using Cargo and m2.
Hope it helps,
-Vincent
PS: This is described in the m2 book going live soon...
> -----Original Message-----
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]
> Sent: mardi 28 mars 2006 01:22
> To: Maven Users List
> Subject: [m2] Using the integration-test phase
>
> If I have some tests that [will eventually] use the Cargo API to start
> a container, that need to be run after the package phase (so that the
> war file exists) and that I want excluded from the test phase... is
> this (see below) close?
>
> The only problem with it is that the *ServerTest classes never get
> compiled. I assume this is because they are excluded from the test
> phase. Do I also need to configure the compiler plugin to work during
> the integration test phase?
>
> Then I found this post in which (I think) Vincent is advocating having
> the 'ServerTest' classes in a different module entirely:
> <http://mail-archives.apache.org/mod_mbox/maven-
> users/200405.mbox/[EMAIL PROTECTED]>
> (If I go that route, what would the <packaging> be for the module that
> only contains in-container tests?)
>
> A list of references, the complete <profile>, and some output are here:
> http://wiki.wsmoak.net/cgi-bin/wiki.pl?Cargo
>
> Advice on whether I'm headed in the right direction would be
> appreciated. There are a few threads on this in the archives, but
> those developers were using Ant to start the container and I couldn't
> work out how their tests were getting compiled.
>
> <profile>
> ...
> <build>
> ...
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <executions>
> <execution>
> <id>surefire-it</id>
> <phase>integration-test</phase>
> <configuration>
> <includes>
> <include>**/*ServerTest.java</include>
> </includes>
> </configuration>
> <goals>
> <goal>test</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <excludes>
> <exclude>**/*ServerTest.java</exclude>
> </excludes>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </profile>
>
> Thanks,
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.geronimo.samples.daytrader</groupId>
<artifactId>daytrader</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>daytrader-tests</artifactId>
<name>DayTrader :: Functional Tests</name>
<packaging>pom</packaging>
<description>DayTrader Functional Tests</description>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.samples.daytrader</groupId>
<artifactId>daytrader-ear</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ear</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-uberjar</artifactId>
<version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-ant</artifactId>
<version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/it</testSourceDirectory>
<!-- We need to force the compiler plugin to compile tests and the surefire plugin to execute
them because we're using a pom packaging that doesn't have those mapped in its lifecycle.
A better solution would be for m2 to define a default integration-test lifecycle -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<wait>false</wait>
<container>
<containerId>geronimo1x</containerId>
<output>geronimo.log</output>
<log>cargo.log</log>
<zipUrlInstaller>
<url>http://www.apache.org/dist/geronimo/1.0/geronimo-tomcat-j2ee-1.0.zip</url>
<installDir>${installDir}</installDir>
</zipUrlInstaller>
</container>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
<configuration>
<deployer>
<deployables>
<deployable>
<groupId>org.apache.geronimo.samples.daytrader</groupId>
<artifactId>daytrader-ear</artifactId>
<type>ear</type>
<properties>
<plan>${basedir}/src/deployment/geronimo/plan.xml</plan>
</properties>
<pingURL>http://localhost:8080/daytrader</pingURL>
</deployable>
</deployables>
</deployer>
</configuration>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]