Author: ptahchiev Date: Sat May 3 05:05:01 2008 New Revision: 653060 URL: http://svn.apache.org/viewvc?rev=653060&view=rev Log: Added documentation on the Maven2 usage.
Added: jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/ jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/index.xml (with props) Modified: jakarta/cactus/trunk/cactus-site/src/site/site.xml Modified: jakarta/cactus/trunk/cactus-site/src/site/site.xml URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/cactus-site/src/site/site.xml?rev=653060&r1=653059&r2=653060&view=diff ============================================================================== --- jakarta/cactus/trunk/cactus-site/src/site/site.xml (original) +++ jakarta/cactus/trunk/cactus-site/src/site/site.xml Sat May 3 05:05:01 2008 @@ -30,7 +30,7 @@ <skin> <groupId>org.apache.cactus</groupId> <artifactId>cactus.maven.skin</artifactId> - <version>2.0.0</version> + <version>2.0.1-SNAPSHOT</version> </skin> <body> <breadcrumbs> @@ -91,6 +91,7 @@ <item name="Goals" href="integration/maven/goals.html"/> <item name="Properties" href="integration/maven/properties.html"/> </item> + <item name="Maven2" href="integration/maven2/index.html"/> <item name="Various IDEs" href="integration/howto_ide.html"/> <item name="JUnitEE" href="integration/howto_junitee.html"/> </item> Added: jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/index.xml URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/index.xml?rev=653060&view=auto ============================================================================== --- jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/index.xml (added) +++ jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/index.xml Sat May 3 05:05:01 2008 @@ -0,0 +1,230 @@ +<?xml version="1.0"?> + +<!-- + * ======================================================================== + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ======================================================================== +--> + +<document id="integration_maven2"> + + <properties> + <title>Maven2 Integration</title> + </properties> + + <body> + + <section name="Maven2 Integration"> + + <p> + Cactus provides a way to execute your tests with <a href="http://maven.apache.org/">Maven2</a>. + To execute the tests you can follow one of the approaches: + <ul> + <li> + either write a <code>build.xml</code>, and use the <a href="../ant/index.html">Ant integration</a>. + After that you call the <code>build.xml</code> through the <code>maven-antrun-plugin</code>. + </li> + <li> + The second approach would be to directly call the + <code>cargo-maven2-plugin</code> in order to start and stop the container. + </li> + </ul> + </p> + + </section> + + <section name="Using the first approach"> + <p> + This section describes how to execute your test-cases from Maven calling + the <code>build.xml</code> with the <code>maven-antrun-plugin</code>. + </p> + <p> + In your <code>pom.xml</code> add the following section: + </p> + <p> + <source> +<![CDATA[<plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <configuration> + <tasks> + <ant antfile="build.xml"/> + </tasks> + </configuration> + </execution> + </executions> +</plugin>]]></source> + </p> + <p> + For more information on how to use the maven-antrun-plugin see the official + webpage of the <a href="http://maven.apache.org/plugins/maven-antrun-plugin/">maven-antrun-plugin</a>. + </p> + <p> + After that see the <a href="../ant/index.html">cactus-ant-integration</a> section to configure your + <code>build.xml</code> file to cactify your war/ear and to execute your tests. Please note that this + approach is more like a hack, which makes it not so flexible. If you need to pass some properties to + the <code>build.xml</code> you can do it from the antrun configuration. Also in order to use the + maven-antrun plugin to execute your tests, you need to have <a href="http://ant.apache.org/">Ant</a> + installed and configured. + </p> + </section> + <section name="Second approach"> + <p> + This section desctibes the second approach to execute Cactus tests with Maven2. + </p> + <p> + From version 1.8.1 the Cactus project provides a maven2 plugin to help you manage + your cactus tests. There are several mojos you can use: <a href="cactifywar.html">cactifywar</a>, + <a href="cactifyear.html">cactiwyear</a> will help you to cactify your archives. + After the cactification process you can use the <code>cargo-maven2-plugin</code> + to start/stop the container and the <code>maven-surefire-plugin</code> to execute the + tests. + </p> + <p> + Here is a sample configuration of the build section of you <code>pom.xml</code>that would: + <ul> + <li>Cactify your war.</li> + <li>Start a container.</li> + <li>Deploy the cactified archive.</li> + <li>Execute the cactus-tests.</li> + <li>Stop the container.</li> + </ul> + </p> + <p> + <source> +<![CDATA[<build> + <plugins> + <plugin> + <groupId>org.apache.cactus</groupId> + <artifactId>cactus.integration.maven2</artifactId> + <version>1.8.1-SNAPSHOT</version> + <configuration> + <srcFile>ready.war</srcFile> + <destFile>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-SNAPSHOT</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.speedbone.de/tomcat/tomcat-5/v5.5.25/bin/apache-tomcat-5.5.25.zip</url> + <installDir>${basedir}/install</installDir> + </zipUrlInstaller> + </container> + <configuration> + <deployables> + <deployable> + <groupId>org.apache.cactus</groupId> + <artifactId>cactus.samples.servlet</artifactId> + <type>war</type> + <properties> + <context>/test</context> + </properties> + <pingURL>http://localhost:8080/</pingURL> + </deployable> + </deployables> + </configuration> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + <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:8080/test/</value> + </property> + </systemProperties> + </configuration> + </execution> + </executions> + </plugin> + </plugins> +</build>]]> + </source> + What we do above is first define the <code>cactus.integration.maven2</code> plugin + in order to cactify the given war file. More on the <code>cactifywar</code> + mojo you can have a look at the configuration <a href="cactifywarmojo.html">page</a> for + this mojo. After that we attach <a href="http://cargo.codehaus.org/">Cargo's</a> + <code>cargo-maven2-plugin</code> to the <code><pre-integration-test></code> and the + <code><post-integration-test></code>. We configure the plugin to start, deploy the artifact + and stop the container. The last thing is to "unbind" the <code>maven-surefire-plugin</code> + from the <code>test</code> phase and bind it with the <code>integration-test</code> phase. + There are a few things to notice here: + <ul> + <li>First of all notice that since there is no <code>post-package</code> we are bound to attach + the <code>cactifywar</code> goal to the <code>pre-integration-test</code> phase. In + order to make it execute before the <code>start-container</code> execution we define it just before the + <code>start-container</code> exection.</li> + <li>Cargo needs a deployable to deploy in the container. This deployable is resolved from the + local maven repository (the one in <code>[USER_HOME]/.m2/repository/</code>). The cactifywar + mojo will install the cactified archive in the local maven repository only if the maven + <code>installInLocalRepo</code> parameter is set to <code>true</code>.</li> + <li>For the <code>maven-surefire-plugin</code> to execute cactus tests, there need to be a few + system properties set.<b>The <code>cactus.contextURL</code> property needs to be set!</b> The value + you have to set it, corresponds to the install url that you install your archives.</li> + <li></li> + </ul> + </p> + </section> + </body> +</document> Propchange: jakarta/cactus/trunk/cactus-site/src/site/xdoc/integration/maven2/index.xml ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]