You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by mark babcock <ma...@gmail.com> on 2010/02/03 14:19:10 UTC

maven2 goals for cactus

I am trying to get maven2 to work with cactus.

I started by creating a new web archetype and then created a servlet
(helloworld ) and then i placed the servlet mappings into my web.xml.
I was able to use jetty and run the servelt with the command mvn
jetty:run-war


Next I wanted to make a cactus test.  I created the following pom.xml (see
below) after fumbling around with sample pom.xml listed on the cactus site
(which doesn't work!).

If I run mvn clean test no cactus stuff  (cactifywar or any cactus tests)
runs.
However, if I run mvn clean install then it at least goes 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 a cactus test
with maven2 and how to run it?


----  pom.xml ---
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="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>


      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
</build>
</project>

RE: maven2 goals for cactus

Posted by "Prins, drs. M.C. (Mark)" <m....@minlnv.nl>.
 

> -----Original Message-----
> From: mark babcock [mailto:markababcock@gmail.com] 
> Sent: Wednesday, February 03, 2010 2:19 PM
> To: Cactus Users List
> Subject: maven2 goals for cactus
> 
> I am trying to get maven2 to work with cactus.
> 
> I started by creating a new web archetype and then created a 
> servlet (helloworld ) and then i placed the servlet mappings 
> into my web.xml.
> I was able to use jetty and run the servelt with the command 
> mvn jetty:run-war
> 
> 
> Next I wanted to make a cactus test.  I created the following 
> pom.xml (see
> below) after fumbling around with sample pom.xml listed on 
> the cactus site (which doesn't work!).
> 
> If I run mvn clean test no cactus stuff  (cactifywar or any 
> cactus tests) runs.
> However, if I run mvn clean install then it at least goes 
> 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 
> a cactus test with maven2 and how to run it?
> 
> 
> ----  pom.xml ---
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="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>
> 
> 
>       </plugin>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-surefire-plugin</artifactId>
>         <configuration>
>           <skip>true</skip>
>         </configuration>
>       </plugin>
>     </plugins>
> </build>
> </project>
> 

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</location>
								<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 test, 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-test with the regular unit test that are run as well


 Met vriendelijke groet,
 
Mark Prins
applicatie ontwikkelaar Geo-Informatie Systemen

-- 

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
--  
Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is gezonden, wordt 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. 

This message may contain information that is not intended for you. If you are 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 no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages.


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org