[prev in list] [next in list] [prev in thread] [next in thread]
List: maven-dev
Subject: svn commit: r690663 - in /maven/plugins/trunk/maven-invoker-plugin/src:
From: bentmann () apache ! org
Date: 2008-08-31 9:11:03
Message-ID: 20080831091104.776B7238898B () eris ! apache ! org
[Download RAW message or body]
Author: bentmann
Date: Sun Aug 31 02:11:02 2008
New Revision: 690663
URL: http://svn.apache.org/viewvc?rev=690663&view=rev
Log:
o Added separate document about filtering
Added:
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm \
(with props) Removed:
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/advance-usage.apt
Modified:
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt.vm
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/index.apt
maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt.vm
maven/plugins/trunk/maven-invoker-plugin/src/site/fml/faq.fml
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/InstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/ja \
va/org/apache/maven/plugin/invoker/InstallMojo.java?rev=690663&r1=690662&r2=690663&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java \
(original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java \
Sun Aug 31 02:11:02 2008 @@ -37,9 +37,9 @@
import org.apache.maven.project.MavenProject;
/**
- * Installs the project artifacts into the local repository as a preparation to run \
the integration tests. More
- * precisely, all artifacts of the project itself, all its locally reachable parent \
POMs and all its dependencies from
- * the reactor will be installed to the local repository.
+ * Installs the project artifacts of the main build into the local repository as a \
preparation to run the sub projects. + * More precisely, all artifacts of the project \
itself, all its locally reachable parent POMs and all its dependencies + * from the \
reactor will be installed to the local repository.
*
* @goal install
* @phase pre-integration-test
Added: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm?rev=690663&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm \
(added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm \
Sun Aug 31 02:11:02 2008 @@ -0,0 +1,130 @@
+ ------
+ Filtering Files
+ ------
+ Benjamin Bentmann
+ ------
+ 2008-08-30
+ ------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Filtering Files
+
+ Some files of the sub projects can be filtered, i.e. special tokens will be \
replaced by some other string before the + actual build is started. In detail, the \
following files will be filtered: +
+ * POM files selected by the include/exclude patterns. The tokens to filter must be \
enclosed in <<<@...@>>> to avoid + interferences with Maven's normal POM \
interpolation, i.e. use <<<@project.version@>>> instead of + \
<<<$\{project.version\}>>>. Starting with version 1.3, the plugin will also \
(recursively) filter all POM files + referenced via <<<\<parent\>>>> or \
<<<\<module\>>>> tags, if the projects are cloned to a temporary location. +
+ * The custom user setting file. Again, the tokens to filter in this file must be \
enclosed in <<<@...@>>>. +
+ * The invoker properties, the goals file and the profiles file. Tokens in these \
files must use the usual Maven syntax + <<<$\{...\}>>>.
+
+ []
+
+ The following example directory structure highlights the files which are filtered \
by the Invoker Plugin: +
+-------------------
+./
++- pom.xml
++- src/
+ +- it/
+ +- settings.xml <- Filtered
+ +- aggregator-project/
+ +- child-module-1/
+ | +- pom.xml <- Filtered
+ +- child-module-2/
+ | +- pom.xml <- Filtered
+ +- pom.xml <- Filtered
+ +- invoker.properties <- Filtered
+ +- goals.txt <- Filtered
+ +- profiles.txt <- Filtered
+-------------------
+
+ Below is the corresponding POM snippet for the plugin configuration:
+
+-------------------
+<project>
+ <properties>
+ <projectPropertyUsedForFiltering>another-value</projectPropertyUsedForFiltering>
+ </properties>
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>\${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <filterProperties>
+ <pluginPropertyUsedForFiltering>some-value</pluginPropertyUsedForFiltering>
+ </filterProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+-------------------
+
+ When filtering the files, the plugin searches various data sources for a token's \
replacement value in the order + indicated below. The search terminates as soon as \
an existing replacement value has been found, i.e. the value + is not <<<null>>>.
+
+ [[1]] Tokens of the form <<<project.*>>> and <<<pom.*>>> will be expanded to the \
referenced POM value if possible, + e.g. <<<project.version>>> refers to the \
version given in <<<pom.xml>>>. If no such POM element exists, the + value \
lookup continues as outlined next. +
+ [[2]] Built-in properties defined by the Invoker Plugin will be processed. See \
this table for a list of available + built-in properties:
+
+*--------------------------+----------------------------------------------------------------------------------+--------+
+|| Built-in Property || Value \
|| Since | +*--------------------------+----------------------------------------------------------------------------------+--------+
+| <<<localRepository>>> | The absolute path to the local repository used for the \
main build. | 1.2 | \
+*--------------------------+----------------------------------------------------------------------------------+--------+
+
+ [[3]] The properties given by the parameter <<<filterProperties>>> in the plugin \
configuration will be consulted for + a property whose key equals the token. \
For the example POM shown above, the value <<<some-value>>> has been + \
associated with the token <<<pluginPropertyUsedForFiltering>>>. +
+ [[4]] The properties given by the POM's <<<\<properties\>>>> section will be \
searched for a property whose key equals + the token. Regarding the example \
POM, the value <<<another-value>>> has been associated with the token + \
<<<projectPropertyUsedForFiltering>>>. +
+ []
+
+ Tokens for which no replacement value could be determined will be left unchanged.
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/filtering.apt.vm
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt.vm?rev=690663&r1=690662&r2=690663&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt.vm \
(original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/post-build-script.apt.vm \
Sun Aug 31 02:11:02 2008 @@ -101,8 +101,8 @@
*--------------------------+----------------------+-----------------------------------------------------------+--------+
|| Name || Type || Description \
|| Since |
*--------------------------+----------------------+-----------------------------------------------------------+--------+
-| basedir | java.io.File | The absolute path to the base \
directory of the test project. | 1.0 | +| <<<basedir>>> | \
<<<java.io.File>>> | The absolute path to the base directory of the test project. | \
1.0 |
*--------------------------+----------------------+-----------------------------------------------------------+--------+
-| localRepositoryPath | java.io.File | The absolute path to the local \
repository used for the Maven invocation. | 1.3 | +| <<<localRepositoryPath>>>| \
<<<java.io.File>>> | The absolute path to the local repository used for the Maven \
invocation on the test project. | 1.3 |
*--------------------------+----------------------+-----------------------------------------------------------+--------+
\ No newline at end of file
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=690663&r1=690662&r2=690663&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 Sun Aug 31 \
02:11:02 2008 @@ -28,16 +28,18 @@
Maven Invoker Plugin
- 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.
-
+ 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. +
+ This plugin is in particular handy to perform integration tests for other Maven \
plugins. The Invoker Plugin can be + employed to run a set of test projects that \
have been designed to assert certain features of the plugin under test. +
* Goals Overview
The Invoker Plugin has two goals:
- * {{{install-mojo.html}invoker:install}} copies the project artifacts into the \
local repository to prepare the
- execution of the integration tests.
+ * {{{install-mojo.html}invoker:install}} copies the project artifacts of the main \
build into the local repository to + prepare the execution of the selected sub \
projects.
* {{{run-mojo.html}invoker:run}} runs a set of Maven projects in a directory and \
verifies the result.
@@ -67,19 +69,21 @@
The following example configurations are available to illustrate selected use \
cases in more detail:
- * {{{examples/clone-projects.html}Clone projects}} to a new directory before \
running. + * {{{examples/clone-projects.html}Clone projects}} to a temporary \
directory before running. +
+ * {{{examples/filtering.html}Filter files}} to introduce some updates before \
starting the build.
* {{{examples/install-artifacts.html}Install}} projects artifacts to a local \
repository before running.
* {{{examples/post-build-script.html}Run a BeanShell or Groovy script}} to verify \
project output.
- * {{{examples/fast-use.html}Fast Invoker Plugin configuration}} to accelerate test \
execution. + * {{{examples/fast-use.html}Fast Invoker Plugin configuration}} to \
accelerate project execution.
- * {{{examples/access-test-classes.html}Access test classes}} to share code between \
IT scripts. + * {{{examples/access-test-classes.html}Access test classes}} to share \
code between hook scripts.
- * {{{examples/invoker-properties.html}Using Invoker Properties}} to configure \
goals, profiles etc. for individual projects. + * \
{{{examples/invoker-properties.html}Use Invoker Properties}} to configure goals, \
profiles etc. for individual projects.
- * {{{examples/prepare-build-env.html}Preparing the Build Environment}} by building \
some setup projects before other projects. + * \
{{{examples/prepare-build-env.html}Prepare the Build Environment}} by building some \
setup projects before other projects.
[]
Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt.vm?rev=690663&r1=690662&r2=690663&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt.vm (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/usage.apt.vm Sun Aug 31 \
02:11:02 2008 @@ -74,6 +74,7 @@
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
+ <settingsFile>src/it/settings.xml</settingsFile>
<localRepositoryPath>target/local-repo</localRepositoryPath>
<postBuildHookScript>verify.bsh</postBuildHookScript>
</configuration>
@@ -107,9 +108,9 @@
Next up, the <<<invoker:run>>> goal will execute during the phase \
<<<integration-test>>> and will use the configured include/exclude patterns to \
search the directory <<<src/it>>> for IT POMs. Every directory where an IT POM is \
found will be copied over to <<<target/it>>>. Additionally, the IT POMs will be \
filtered, i.e. expressions like
- <<<@pom.version@>>> will be replaced with the corresponding values from the \
project's POM. This is especially handy to make
- sure your IT POMs always reference the currently built version of the project \
artifact. You can also define other
- properties via the plugin configuration that you wish to use for filtering.
+ <<<@project.version@>>> will be replaced with the corresponding values from the \
project's POM. This is especially + handy to make sure your IT POMs always reference \
the currently built version of the project artifact. You can also + define other \
properties via the plugin configuration that you wish to use for filtering.
Once the IT POMs have been filtered, a Maven build will be started on them. By \
default, the Invoker Plugin will execute the phase <<<package>>> on the IT POMs but \
that can be changed globally in the plugin configuration or for an individual @@ \
-126,3 +127,15 @@ this is the case for <<<second-it>>> where <<<verify.bsh>>> will \
be run. The purpose of this script is usally to check that the build of the \
integration test did not only succeed but also produced the intended output. Have a \
look at the example {{{examples/post-build-script.html}Using a Post Build Script}} \
for a code snippet. +
+* Running Only Some Tests
+
+ The plugin also supports a parameter <<<-Dinvoker.test>>> to run only ITs in the \
directories matched by the patterns + used in the parameter. This enables you to \
quickly rerun individual tests. See this example command line: +
++---
+ mvn invoker:run -Dinvoker.test=*MWAR*,simple*
++---
+
+ Assuming the base directory of the sub projects is <<<src/it>>>, the plugin will \
only run projects from directories + matching the path <<<src/it/*MWAR*>>> and \
<<<src/it/simple*>>>.
Modified: maven/plugins/trunk/maven-invoker-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/fml/faq.fml?rev=690663&r1=690662&r2=690663&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/fml/faq.fml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/fml/faq.fml Sun Aug 31 02:11:02 \
2008 @@ -50,7 +50,7 @@
<question>How can I share common code between the pre-/post-build \
scripts?</question> <answer>
<p>
- If you want to avoid copy&paste of lengthy code snippets within the IT \
scripts, you can move this code + If you want to avoid copy&paste of \
lengthy code snippets within the hook scripts, you can move this code
into a regular Java class. More precisely, you would place this utility \
code somewhere in your test source
tree and set the plugin parameter <a \
href="run-mojo.html#addTestClassPath"><code>addTestClassPath</code></a> to \
<code>true</code>. For more details, please see the example
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=690663&r1=690662&r2=690663&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/site.xml Sun Aug 31 02:11:02 \
2008 @@ -25,13 +25,13 @@
<item name="Introduction" href="index.html"/>
<item name="Goals" href="plugin-info.html"/>
<item name="Usage" href="usage.html"/>
- <item name="Advanced Usage" href="advance-usage.html"/>
<item name="FAQ" href="faq.html"/>
</menu>
<menu name="Examples">
<item name="Accessing Test Classes" href="examples/access-test-classes.html"/>
<item name="Cloning Projects" href="examples/clone-projects.html"/>
+ <item name="Filtering Files" href="examples/filtering.html"/>
<item name="Fast Build Configuration" href="examples/fast-use.html"/>
<item name="Installing Artifacts" href="examples/install-artifacts.html"/>
<item name="Invoker Properties" href="examples/invoker-properties.html"/>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic