You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pg...@apache.org on 2008/04/22 17:37:02 UTC
svn commit: r650552 - in /maven/plugins/trunk/maven-invoker-plugin/src:
main/java/org/apache/maven/plugin/invoker/ site/ site/apt/ site/apt/examples/
Author: pgier
Date: Tue Apr 22 08:36:47 2008
New Revision: 650552
URL: http://svn.apache.org/viewvc?rev=650552&view=rev
Log:
[MINVOKER-22] Adding site documentation for install feature, and some other site improvements.
Added:
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt (with props)
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt (with props)
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt (with props)
Modified:
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/index.apt
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt
maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java?rev=650552&r1=650551&r2=650552&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java Tue Apr 22 08:36:47 2008
@@ -70,7 +70,7 @@
/**
* Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and
- * outputting the results to the screen.
+ * outputting the results to the command line.
*
* @goal run
* @since 1.0
@@ -82,6 +82,8 @@
extends AbstractMojo
{
/**
+ * Maven artifact install component to copy artifacts to the local repository.
+ *
* @parameter expression="${component.org.apache.maven.artifact.installer.ArtifactInstaller}"
* @required
* @readonly
@@ -178,6 +180,8 @@
/**
* Includes for searching the integration test directory. This parameter is meant to be set from the POM.
+ * If this parameter is not set, the plugin will search for all pom.xml files one directory below
+ * {@link #projectDirectory projectDirectory} (*/pom.xml).
*
* @parameter
*/
@@ -298,6 +302,7 @@
* and <code>pomExcludes</code> parameters. Each pattern you specify here will be used to create an
* include pattern formatted like <code>${projectsDirectory}/${invoker.test}</code>,
* so you can just type "-Dinvoker.test=MyTest" to run a single it in ${projectsDirectory}/${invoker.test}".
+ *
* @parameter expression="${invoker.test}"
* @since 1.1
*/
@@ -306,6 +311,7 @@
/**
* The name of the project-specific file that contains the enumeration of profiles to use for that test.
* <b>If the file exists and empty no profiles will be used even if the profiles is set</b>
+ *
* @parameter expression="${invoker.profilesFile}" default-value="profiles.txt"
* @since 1.1
*/
Added: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt?rev=650552&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt Tue Apr 22 08:36:47 2008
@@ -0,0 +1,48 @@
+ ------
+ Clone Projects Example
+ ------
+ Paul Gier
+ ------
+ 18 April 2008
+ ------
+
+Clone Projects Example
+
+ By default the projects will be executed in the same directory where they are found.
+ This means that build output will be generated with the project files. It may be
+ helpful to copy the projects to another directory before running them, for example
+ <<<target/it>>>. This will allow <<<mvn clean>>> to remove the output generated
+ by all of the test projects.
+
+-------------------
+<project>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <installProjectArtifacts>true</installProjectArtifacts>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ ...
+</project>
+-------------------
+
+
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/clone-projects.apt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt?rev=650552&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt Tue Apr 22 08:36:47 2008
@@ -0,0 +1,49 @@
+ ------
+ Installing Artifacts Example
+ ------
+ Paul Gier
+ ------
+ 18 April 2008
+ ------
+
+Installing Artifacts Example
+
+ The following example shows a plugin configuration with the \<installProjectArtifacts\>
+ parameter set to true. This will cause the project artifact(s) to be installed to the local
+ repository before executing the projects. This can be helpful if you
+ want to build you project and test the new artifacts artifact in a single step instead of
+ installing first and then running tests.
+
+-------------------
+<project>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <localRepositoryPath>target/local-repo</localRepositoryPath>
+ <installProjectArtifacts>true</installProjectArtifacts>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ ...
+</project>
+-------------------
+
+
+
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/install-artifacts.apt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt?rev=650552&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt Tue Apr 22 08:36:47 2008
@@ -0,0 +1,72 @@
+ ------
+ Installing Artifacts Example
+ ------
+ Paul Gier
+ ------
+ 22 April 2008
+ ------
+
+Example using postBuildHookScript
+
+ Here is an example of how the invoker plugin can be used to run a set
+ of Maven projects and then verfier they output with a Beanshell script.
+ The name of the script file in this case is verify.bsh
+
+-------------------
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ <pomExcludes>
+ <pomExclude>**/child*/pom.xml</pomExclude>
+ <pomExclude>**/module*/pom.xml</pomExclude>
+ </pomExcludes>
+ <postBuildHookScript>verify.bsh</postBuildHookScript>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+-------------------
+
+ Here is an example post build script (verify.bsh) that checks for the existence
+ of a jar file after the build has run. If the jar file does not exist, the
+ script returns false which causes the invoker plugin to log that the build failed.
+
+-------------------
+import java.io.*;
+
+try
+{
+ File file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" );
+ if ( !file.exists() || file.isDirectory() )
+ {
+ System.err.println( "Could not find generated jar: " + file );
+ return false;
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
+-------------------
+
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/index.apt?rev=650552&r1=650551&r2=650552&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/index.apt Tue Apr 22 08:36:47 2008
@@ -8,15 +8,28 @@
Maven 2 Invoker Plugin
- The invoker Plugin is used to run a set of Maven projects and makes sure that each
- project execution is successful, and optionally verifies the output from a given project execution.
-
+ The invoker plugin is used to run a set of Maven projects. The plugin can determine whether each
+ project execution is successful, and optionally can verify the output generated from a given
+ project execution.
+
* Goals Overview
- * {{{run-mojo.html}invoker:run}} runs a set of Maven projects that you have configured in your POM.
+ * {{{run-mojo.html}invoker:run}} runs a set of Maven projects in a directory and verifies the result.
[]
* Usage
- Instructions on how to use the Invoker Plugin can be found {{{usage.html}here}}.
+ General instructions on how to use the Invoker Plugin can be found on the {{{usage.html}usage page}}.
+
+* Examples
+
+ The following example configurations are available:
+
+ * {{{examples/clone-projects.html}Clone projects}} to a new directory before running.
+
+ * {{{examples/install-artifacts.html}Install}} projects artifacts to a local repository before running.
+
+ * {{{examples/post-build-script.html}Run a Beanshell script}} to verify project output.
+
+ []
Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt?rev=650552&r1=650551&r2=650552&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt Tue Apr 22 08:36:47 2008
@@ -10,9 +10,16 @@
* How to use the invoker plugin
- Below is an example of how the invoker plugin is used to test the maven-antrun-plugin. We are
- executing a set of Maven projects and ensuring everything is all right:
+ This page provides general usage information along with some basic examples. The plugin
+ is commonly used to run and verify integration tests for a project. This is done using
+ the {{{run-mojo.html} run }} goal.
+* Basic example
+
+ The following example shows basic plugin configuration for running integration tests.
+ The projects directory (src/it) is the location where the plugin will look for test projects
+ to execute. The plugin is set to find and run all pom.xml files in this directory.
+
-------------------
<project>
...
@@ -20,13 +27,6 @@
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
- <configuration>
- <debug>true</debug>
- <projectsDirectory>src/it</projectsDirectory>
- <pomIncludes>
- <pomInclude>**/pom.xml</pomInclude>
- </pomIncludes>
- </configuration>
<executions>
<execution>
<id>integration-test</id>
@@ -34,6 +34,12 @@
<goals>
<goal>run</goal>
</goals>
+ <configuration>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -41,41 +47,5 @@
</build>
...
</project>
--------------------
-
- Here is an example of how the invoker plugin is used with the maven-assembly-plugin to run a set
- of Maven projects and then verfier they output with a Beanshell script:
-
--------------------
-<project>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-invoker-plugin</artifactId>
- <configuration>
- <debug>true</debug>
- <projectsDirectory>src/it</projectsDirectory>
- <pomIncludes>
- <pomInclude>**/pom.xml</pomInclude>
- </pomIncludes>
- <pomExcludes>
- <pomExclude>**/child*/pom.xml</pomExclude>
- <pomExclude>**/module*/pom.xml</pomExclude>
- </pomExcludes>
- <postBuildHookScript>verify.bsh</postBuildHookScript>
- </configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
-------------------
Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml?rev=650552&r1=650551&r2=650552&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml Tue Apr 22 08:36:47 2008
@@ -28,11 +28,13 @@
<item name="Advanced Usage" href="advance-usage.html"/>
<item name="FAQ" href="faq.html"/>
</menu>
- <!--
+
<menu name="Examples">
- <item name="Alternate Location for the changes.xml File" href="examples/alternate-changes-xml-location.html"/>
- <item name="SMTP Authentication" href="examples/smtp-authentication.html"/>
+ <item name="Basic Example" href="usage.html"/>
+ <item name="Clone Projects" href="examples/clone-projects.html"/>
+ <item name="Install Artifacts" href="examples/install-artifacts.html"/>
+ <item name="Post Build Script" href="examples/post-build-script.html"/>
</menu>
- -->
+
</body>
</project>