RE: maven2 goals for cactus
"Prins, drs. M.C. (Mark)" <[email protected]> Fri, 5 Feb 2010 10:11:01 +0100
| Newsgroups | gmane.comp.jakarta.cactus.user |
|---|---|
| Message-ID | <DC511A9DB684F742A835A9EDC55C39D63EB275@minlnv1103s.minlnv.agro.nl> |
=20 > -----Original Message----- > From: mark babcock [mailto:[email protected]]=20 > Sent: Wednesday, February 03, 2010 2:19 PM > To: Cactus Users List > Subject: maven2 goals for cactus >=20 > I am trying to get maven2 to work with cactus. >=20 > I started by creating a new web archetype and then created a=20 > servlet (helloworld ) and then i placed the servlet mappings=20 > into my web.xml. > I was able to use jetty and run the servelt with the command=20 > mvn jetty:run-war >=20 >=20 > Next I wanted to make a cactus test. I created the following=20 > pom.xml (see > below) after fumbling around with sample pom.xml listed on=20 > the cactus site (which doesn't work!). >=20 > If I run mvn clean test no cactus stuff (cactifywar or any=20 > cactus tests) runs. > However, if I run mvn clean install then it at least goes=20 > through and makes > a cactifywar. I am still unable to run mvn cactus:test it says the > required goal not > found. Is there any documentation that works on how to great=20 > a cactus test with maven2 and how to run it? >=20 >=20 > ---- pom.xml --- > <project xmlns=3D"http://maven.apache.org/POM/4.0.0" xmlns:xsi=3D" > http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=3D"http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/maven-v4_0_0.xsd"> > <modelVersion>4.0.0</modelVersion> > <groupId>gov.virginia.dss</groupId> > <artifactId>RajDemoHudsonCactus</artifactId> > <packaging>war</packaging> > <version>1.0-SNAPSHOT</version> > <name>RajDemoHudsonCactus Maven Webapp</name> > <url>http://maven.apache.org</url> > <repositories> > <repository> > <id>java.net</id> > <url>http://download.java.net/maven/2</url> > </repository> > </repositories> > <dependencies> > <dependency> > <groupId>junit</groupId> > <artifactId>junit</artifactId> > <version>4.4</version> > <scope>test</scope> > </dependency> > <dependency> > <groupId>javax</groupId> > <artifactId>javaee-api</artifactId> > <version>6.0</version> > <scope>compile</scope> > </dependency> > <dependency> > <groupId>org.apache.cactus</groupId> > <artifactId>cactus.core.framework.uberjar.javaEE.15</artifactId> > <version>1.8.1</version> > </dependency> > <dependency> > <groupId>org.apache.cactus</groupId> > <artifactId>cactus.integration.shared.api</artifactId> > <version>1.8.1</version> > </dependency> > </dependencies> > <build> > <finalName>RajDemoHudsonCactus</finalName> > <plugins> > <plugin> > <groupId>org.mortbay.jetty</groupId> > <artifactId>maven-jetty-plugin</artifactId> > </plugin> > <plugin> > <groupId>org.apache.cactus</groupId> > <artifactId>cactus.integration.maven2</artifactId> > <version>1.8.1</version> > <configuration> > <srcFile>target/RajDemoHudsonCactus.war</srcFile> > <destFile>target/cactifiedByMaven2.war</destFile> > </configuration> > <executions> > <execution> > <id>cactus-cactifywar</id> > <phase>pre-integration-test</phase> > <goals> > <goal>cactifywar</goal> > </goals> > </execution> > </executions> > </plugin> > <plugin> > <groupId>org.codehaus.cargo</groupId> > <artifactId>cargo-maven2-plugin</artifactId> > <version>1.0</version> >=20 >=20 > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <configuration> > <skip>true</skip> > </configuration> > </plugin> > </plugins> > </build> > </project> >=20 I use the following inside the build: <plugin> <groupId>org.apache.cactus</groupId> <artifactId>cactus.integration.maven2</artifactId> <version>1.8.1</version> <configuration> <srcFile>${project.build.directory}/restutils.war</srcFile> <destFile>${project.build.directory}/cactifiedByMaven2.war</destFile> <libDependencies /> <testClasses> <directory>${project.build.directory}/test-classes</directory> <includes> <include>**/*Test*.*</include> </includes> </testClasses> </configuration> <executions> <execution> <id>cactus-cactifywar</id> <phase>pre-integration-test</phase> <goals> <goal>cactifywar</goal> </goals> </execution> </executions> </plugin> To create a catified war, then <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.0</version> <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> <wait>false</wait> <timeout>20000</timeout> <container> <containerId>tomcat5x</containerId> <zipUrlInstaller> <url>http://apache.cs.uu.nl/dist/tomcat/tomcat-5/v5.5.28/bin/apache-= tomcat-5.5.28.zip</url> <installDir>${basedir}/tc-install</installDir> <proxy> <host>wpad</host> <port>8080</port> </proxy> </zipUrlInstaller> </container> <configuration> <deployables> <deployable> <location>${project.build.directory}/cactifiedByMaven2.war</locatio= n> <pingURL>http://localhost:8820/test/</pingURL> <properties> <context>/test</context> </properties> </deployable> </deployables> <properties> <cargo.servlet.port>8820</cargo.servlet.port> </properties> </configuration> </configuration> </plugin> To get a version of tomcat for running the test and then for running the te= st, run the test with mvn integration-test <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> <version>2.4.3</version> <executions> <execution> <id>surefire-it</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> <systemProperties> <property> <name>cactus.contextURL</name> <value>http://localhost:8820/test</value> </property> </systemProperties> </configuration> </execution> </executions> </plugin> I haven't found a way yet to merge the test coverage / results of the it-te= st with the regular unit test that are run as well Met vriendelijke groet, =20 Mark Prins applicatie ontwikkelaar Geo-Informatie Systemen --=20 GIS Competence Center (een samenwerking van DLG en DR) Dienst Landelijk Gebied Kamer 11.27 Herman Gorterstraat 5 3511 EW Utrecht Postbus 20021 3502 LA Utrecht tel: 030 275 6877 / fax: 030 275 6999 / twitter: @mc_prins -- =20 Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u ni= et de geadresseerde bent of dit bericht abusievelijk aan u is gezonden, wor= dt u verzocht dat aan de afzender te melden en het bericht te verwijderen. = De Staat aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, = die verband houdt met risico's verbonden aan het elektronisch verzenden van= berichten.=20 This message may contain information that is not intended for you. If you a= re not the addressee or if this message was sent to you by mistake, you are= requested to inform the sender and delete the message. The State accepts n= o liability for damage of any kind resulting from the risks inherent in the= electronic transmission of messages.