You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2011/06/27 16:04:29 UTC
svn commit: r1140166 - in /maven/surefire/trunk: maven-failsafe-plugin/
maven-failsafe-plugin/src/site/apt/
maven-failsafe-plugin/src/site/apt/examples/ maven-surefire-plugin/
Author: stephenc
Date: Mon Jun 27 14:04:29 2011
New Revision: 1140166
URL: http://svn.apache.org/viewvc?rev=1140166&view=rev
Log:
working towards having a single set of docs... use velocity #{if}'s to pull in the plugin specific content
Added:
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm (contents, props changed)
- copied, changed from r1140142, maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt.vm (contents, props changed)
- copied, changed from r1140142, maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm (contents, props changed)
- copied, changed from r1140142, maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt
Removed:
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt
Modified:
maven/surefire/trunk/maven-failsafe-plugin/pom.xml
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/configuring-classpath.apt.vm
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/system-properties.apt.vm
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/testng.apt.vm
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/usage.apt.vm
maven/surefire/trunk/maven-surefire-plugin/pom.xml
Modified: maven/surefire/trunk/maven-failsafe-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/pom.xml?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/pom.xml (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/pom.xml Mon Jun 27 14:04:29 2011
@@ -119,6 +119,11 @@
</site>
</distributionManagement>
+ <properties>
+ <thisPlugin>Failsafe</thisPlugin>
+ <thatPlugin>Surefire</thatPlugin>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm Mon Jun 27 14:04:29 2011
@@ -27,16 +27,16 @@
~~ http://maven.apache.org/doxia/references/apt-format.html
-Classloading and Forking in Maven Surefire/Failsafe
+Classloading and Forking in Maven Surefire
- This page discusses classloading and forking under Maven Surefire/Failsafe, with an eye
- towards troubleshooting problems.
+ This page discusses classloading and forking under Maven Surefire which is a shared component used by both
+ the Surefire and Failsafe Maven plugins, with an eye towards troubleshooting problems.
* Executive Summary
If you're having problems, you'll probably want to tinker with these three settings: <<<forkMode>>>, <<<useSystemClassLoader>>>, and <<<useManifestOnlyJar>>>.
-* What problem does Surefire solve?
+* What problem does the Maven Surefire project solve?
Initially, the problem seems simple enough. Just launch Java with a classpath, like this:
@@ -49,7 +49,7 @@ java -classpath foo.jar:bar.jar MyApp
on different versions of Windows; in some versions only a few hundred characters are allowed, in others
a few thousand, but the limit can be pretty severe in either case.
- * Update for Surefire 2.8.2
+ * Update for Maven Surefire 2.8.2
It turns out setting the CLASSPATH as an environment variable may remove most of the
practical length limitations, as documented in http://jira.codehaus.org/browse/SUREFIRE-727. This means
@@ -119,7 +119,7 @@ java -classpath booter.jar MyApp
classpath the default, though we do provide it as an option (mostly as a last
resort).
-* What does Surefire do?
+* What does Maven Surefire do?
Surefire provides a mechanism for using multiple strategies. The main parameter that
determines this is called <<<useSystemClassLoader>>>. If <<<useSystemClassLoader>>> is
@@ -155,20 +155,6 @@ java -classpath booter.jar MyApp
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
@@ -186,4 +172,4 @@ java -classpath booter.jar MyApp
* If you're using the defaults, <<<useSystemClassLoader=true>>> and <<<useManifestOnlyJar=false>>>. In that case, look at the generated manifest-only Surefire booter JAR. Open it up (it's just a zip) and read its manifest.
- * Run mvn with -Dmaven.failsafe.debug, and attach to the running process with a debugger.
\ No newline at end of file
+ * Run mvn with -Dmaven.${thisPlugin.toLowerCase()}.debug, and attach to the running process with a debugger.
\ No newline at end of file
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/configuring-classpath.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/configuring-classpath.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/configuring-classpath.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/configuring-classpath.apt.vm Mon Jun 27 14:04:29 2011
@@ -28,19 +28,26 @@
The Default Classpath
- The failsafe plugin builds the test classpath in the following order:
+ The ${thisPlugin} plugin builds the test classpath in the following order:
+#{if}(${project.artifactId}=="maven-surefire-plugin")
[[1]] The {{{../test-mojo.html#testClassesDirectory}test-classes}} directory
[[2]] The {{{../test-mojo.html#classesDirectory}classes}} directory
+#{else}
+ [[1]] The {{{../integration-test-mojo.html#testClassesDirectory}test-classes}} directory
+
+ [[2]] The {{{../integration-test-mojo.html#classesDirectory}classes}} directory
+
+#{end}
[[3]] The project dependencies
[[4]] Additional classpath elements
Additional Classpath Elements
- If you need to put more stuff in your classpath when Surefire executes (e.g some funky resources or a container specific JAR),
+ If you need to put more stuff in your classpath when ${thisPlugin} executes (e.g some funky resources or a container specific JAR),
we normally recommend you add it to your classpath as a dependency. Consider deploying shared jars to a private remote repository for your
organization.
@@ -64,20 +71,6 @@ Additional Classpath Elements
<additionalClasspathElement>path/to/additional/jar</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
@@ -105,20 +98,6 @@ Removing Dependency Classpath Elements
<classpathDependencyExcludes>org.apache.commons:commons-email</classpathDependencyExcludes>
</classpathDependencyExcludes>
</configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
@@ -148,20 +127,6 @@ Removing Dependency Classpath Elements
<configuration>
<classpathDependencyScopeExclude>runtime</classpathDependencyScopeExclude>
</configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
Copied: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm (from r1140142, maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm?p2=maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm&p1=maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt&r1=1140142&r2=1140166&rev=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm Mon Jun 27 14:04:29 2011
@@ -32,11 +32,11 @@ Debugging Tests
Forked Tests
- By default, Maven runs your tests in a separate ("forked") process. You can use the <<<maven.failsafe.debug>>> property
+ By default, Maven runs your tests in a separate ("forked") process. You can use the <<<maven.${thisPlugin.toLowerCase()}.debug>>> property
to debug your forked tests remotely, like this:
+---+
-mvn -Dmaven.failsafe.debug verify
+mvn -Dmaven.${thisPlugin.toLowerCase()}.debug verify
+---+
The tests will automatically pause and await a remote debugger on port 5005. You can then attach to the running tests
@@ -47,7 +47,7 @@ mvn -Dmaven.failsafe.debug verify
instead of port 5005.
+---+
-mvn -Dmaven.failsafe.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" verify
+mvn -Dmaven.${thisPlugin.toLowerCase()}.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" verify
+---+
Non-forked Tests
Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/debugging.apt.vm
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm Mon Jun 27 14:04:29 2011
@@ -30,9 +30,11 @@ Inclusions and Exclusions of Tests
* Inclusions
- By default, the Failsafe Plugin will automatically include all test classes
+ By default, the ${thisPlugin} Plugin will automatically include all test classes
with the following wildcard patterns:
+#{if}(${project.artifactId}=="maven-surefire-plugin")
+#{else}
* <"**/IT*.java"> - includes all of its subdirectories and all java
filenames that start with "IT".
@@ -42,10 +44,12 @@ Inclusions and Exclusions of Tests
* <"**/*ITCase.java"> - includes all of its subdirectories and all java
filenames that end with "ITCase".
+#{end}
+
[]
If the test classes does not go with the naming convention, then configure
- Failsafe Plugin and specify the tests you want to include.
+ ${thisPlugin} Plugin and specify the tests you want to include.
+---+
<project>
@@ -61,22 +65,6 @@ Inclusions and Exclusions of Tests
<include>Sample.java</include>
</includes>
</configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <phase>verify</phase>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
@@ -106,20 +94,6 @@ Inclusions and Exclusions of Tests
<exclude>**/SquareIT.java</exclude>
</excludes>
</configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
Copied: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt.vm (from r1140142, maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt.vm?p2=maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt.vm&p1=maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt&r1=1140142&r2=1140166&rev=1140166&view=diff
==============================================================================
(empty)
Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/single-test.apt.vm
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/skipping-test.apt.vm Mon Jun 27 14:04:29 2011
@@ -58,14 +58,16 @@ Skipping Tests
mvn install -DskipTests
+---+
- Since <<<skipTests>>> is also followed by the Surefire Plugin, this will have the effect
+#{if}(${project.artifactId}=="maven-failsafe-plugin")
+ Since <<<skipTests>>> is also followed by the ${thatPlugin} Plugin, this will have the effect
of not running any tests. If, instead, you want to skip only the integration tests
- being run by the Failsafe Plugin, you would use the <<<skipITs>>> property
-
+ being run by the ${thisPlugin} Plugin, you would use the <<<skipITs>>> property
+
+---+
mvn install -DskipITs
+---+
+#{end}
If you absolutely must, you can also use the <<<maven.test.skip>>> property to skip compiling the tests.
<<<maven.test.skip>>> is honored by Surefire, Failsafe and the Compiler Plugin.
@@ -79,12 +81,14 @@ Skipping by default
command line, you need to go via a properties section in the pom:
+---+
-<properties>
- <skipTests>true</skipTests>
-</properties>
-
-<build>
- <plugins>
+<project>
+ [...]
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+ [...]
+ <build>
+ <plugins>
<plugin>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
@@ -92,9 +96,11 @@ Skipping by default
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
- </plugin>
-</plugins>
-</build>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
+---+
This will allow you to run with tests disabled by default and to run them with this command:
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/system-properties.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/system-properties.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/system-properties.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/system-properties.apt.vm Mon Jun 27 14:04:29 2011
@@ -29,7 +29,7 @@
Using System Properties
- There are two ways to add a list of system properties to Failsafe:
+ There are two ways to add a list of system properties to ${thisPlugin}:
* systemPropertyVariables
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/testng.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/testng.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/testng.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/testng.apt.vm Mon Jun 27 14:04:29 2011
@@ -61,7 +61,7 @@ Using TestNG
This is the only step that is required to get started - you can now create tests in your test source directory
(eg, <<<src/test/java>>>. As long as they are named using the defaults such as <<<*IT.java>>> they will be run
- by Failsafe as TestNG tests.
+ by ${thisPlugin} as TestNG tests.
If you'd like to use a different naming scheme, you can change the <<<includes>>> parameter, as discussed in the
{{{./inclusion-exclusion.html}Inclusions and Exclusions of Tests}} example.
@@ -69,7 +69,7 @@ Using TestNG
* Using Suite XML Files
Another alternative is to use TestNG suite XML files. This allows flexible configuration of the tests to be run.
- These files are created in the normal way, and then added to the Failsafe Plugin configuration:
+ These files are created in the normal way, and then added to the ${thisPlugin} Plugin configuration:
+---+
[...]
@@ -108,11 +108,11 @@ Using TestNG
[...]
+---+
- For more information about setting system properties in Failsafe tests, see {{{./system-properties.html}System Properties}}.
+ For more information about setting system properties in ${thisPlugin} tests, see {{{./system-properties.html}System Properties}}.
* Using Groups
- TestNG allows you to group your tests. You can then execute one or more specific groups. To do this with Failsafe,
+ TestNG allows you to group your tests. You can then execute one or more specific groups. To do this with ${thisPlugin},
use the <<<groups>>> parameter, for example:
+---+
Copied: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm (from r1140142, maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm?p2=maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm&p1=maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt&r1=1140142&r2=1140166&rev=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm Mon Jun 27 14:04:29 2011
@@ -30,9 +30,9 @@
Maven Failsafe Plugin
- The Failsafe Plugin is designed to run integration tests while the Surefire Plugins is designed to run unit. The name
- (failsafe) was chosen both because it is a synonym of surefire and because it implies that when it fails, it does so
- in a safe way.
+ The Failsafe Plugin is designed to run integration tests while the Surefire Plugins is designed to run unit tests.
+ The name (failsafe) was chosen both because it is a synonym of surefire and because it implies that when it fails, it
+ does so in a safe way.
The Maven lifecycle has four phases for running integration tests:
@@ -70,7 +70,7 @@ mvn verify
[]
- By default, these files are generated at <<<$\{basedir\}/target/failsafe-reports>>>.
+ By default, these files are generated at <<<$\{basedir\}/target/${thisPlugin.toLowerCase()}-reports>>>.
For an HTML format of the report, please see the
{{{http://maven.apache.org/plugins/maven-surefire-report-plugin/}Maven Surefire Report Plugin}}.
Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/index.apt.vm
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/usage.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/usage.apt.vm?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/usage.apt.vm (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/usage.apt.vm Mon Jun 27 14:04:29 2011
@@ -30,7 +30,7 @@
Usage
- To use the Failsafe Plugin, you need to add the following configuration to
+ To use the ${thisPlugin} Plugin, you need to add the following configuration to
your <<<pom.xml>>>
+---+
@@ -44,14 +44,8 @@ Usage
<version>${project.version}</version>
<executions>
<execution>
- <id>integration-test</id>
<goals>
<goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <goals>
<goal>verify</goal>
</goals>
</execution>
@@ -63,7 +57,7 @@ Usage
</project>
+---+
- Then Failsafe Plugin can be invoked by calling the <<<verify>>> phase of the
+ Then ${thisPlugin} Plugin can be invoked by calling the <<<verify>>> phase of the
build lifecycle.
+---+
@@ -85,9 +79,9 @@ mvn verify
for TestNG). Since this is required to compile the test classes anyway, no
additional configuration is required.
- Note that any normal Surefire integration works identically no matter which
+ Note that any normal ${thatPlugin} integration works identically no matter which
providers are in use - so you can still produce a Cobertura report and a
- Failsafe results report on your project web site for your TestNG tests,
+ ${thisPlugin} results report on your project web site for your TestNG tests,
for example.
The POJO provider above allows you to write tests that do not depend on
@@ -96,13 +90,14 @@ mvn verify
assertions, the JDK 1.4 <<<assert>>> keyword can be used, or you can use
<<<org.apache.maven.surefire.assertion.Assert>>>.
- All of the providers support the Surefire Plugin parameter configurations.
+ All of the providers support the ${thatPlugin} Plugin parameter configurations.
However, there are additional options available if you are running TestNG
tests (including if you are using TestNG to execute your JUnit tests, which
- occurs by default if both are present in Surefire).
+ occurs by default if both are present in ${thatPlugin}).
See {{{./examples/testng.html} Using TestNG}} for more information.
+#{if}(${project.artifactId}=="maven-failsafe-plugin")
* Using jetty and ${project.artifactId}
You need to bind one of <<<jetty:run>>>, <<<jetty:run-exploded>>> or <<<jetty:run-war>>>
@@ -235,8 +230,8 @@ mvn verify
* Reporting integration test results
- The Failsafe Plugin uses the exact same format as the Surefire Plugin, so to generate a report you just add a second
- Surefire Report Plugin report set using the Failsafe reports directory, e.g.
+ The ${thisPlugin} Plugin uses the exact same format as the ${thatPlugin} Plugin, so to generate a report you just add a second
+ Surefire Report Plugin report set using the ${thisPlugin} reports directory, e.g.
+---+
<project>
@@ -327,3 +322,91 @@ mvn verify
</project>
+---+
+* Using in multi-module projects
+
+ The recommendations for using the ${thisPlugin} Plugin listed at the top of this page are fine for 95% of use cases.
+ When you are defining a shared definition of the ${thisPlugin} Plugin in a parent pom, it is considered best practice
+ to define an execution id in order to allow child projects to override the configuration. Thus you might have the
+ following in your parent <<<pom.xml>>>
+
++---+
+<project>
+ [...]
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ [...]
+</project>
++---+
+
+ The child projects can then trigger usage of the ${thisPlugin} Plugin with
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
+
+ For very complex builds, it may be better to separate the executions for the <<<integration-test>>> and <<<verify>>>
+ goals.
+
++---+
+<project>
+ [...]
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ [...]
+</project>
++---+
+
+#{end}
\ No newline at end of file
Modified: maven/surefire/trunk/maven-surefire-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/pom.xml?rev=1140166&r1=1140165&r2=1140166&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/pom.xml (original)
+++ maven/surefire/trunk/maven-surefire-plugin/pom.xml Mon Jun 27 14:04:29 2011
@@ -126,6 +126,11 @@
</site>
</distributionManagement>
+ <properties>
+ <thisPlugin>Surefire</thisPlugin>
+ <thatPlugin>Failsafe</thatPlugin>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>