You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/08/17 20:55:31 UTC

svn commit: r686631 - in /maven/plugins/trunk/maven-invoker-plugin/src: it/project-setup/ it/project-setup/src/ it/project-setup/src/it/ it/project-setup/src/it/project1/ it/project-setup/src/it/project2/ it/project-setup/src/it/project3/ it/project-se...

Author: bentmann
Date: Sun Aug 17 11:55:30 2008
New Revision: 686631

URL: http://svn.apache.org/viewvc?rev=686631&view=rev
Log:
[MINVOKER-58] Allow to declare setup projects which must be run before all the rest

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm   (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/site.xml

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml Sun Aug 17 11:55:30 2008
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>org.apache.maven.plugins.invoker</groupId>
+  <artifactId>project-setup</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>Test to check that setup projects are run ahead of the other ones.</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <projectsDirectory>src/it</projectsDirectory>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <setupIncludes>
+            <setupInclude>project3/pom.xml</setupInclude>
+          </setupIncludes>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml Sun Aug 17 11:55:30 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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>test</groupId>
+  <artifactId>project1</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml Sun Aug 17 11:55:30 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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>test</groupId>
+  <artifactId>project2</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project2/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml Sun Aug 17 11:55:30 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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>test</groupId>
+  <artifactId>project3</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project3/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml Sun Aug 17 11:55:30 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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>test</groupId>
+  <artifactId>project4</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project4/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml Sun Aug 17 11:55:30 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<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>test</groupId>
+  <artifactId>project5</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/src/it/project5/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh Sun Aug 17 11:55:30 2008
@@ -0,0 +1,41 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+import org.codehaus.plexus.util.*;
+
+try
+{
+    File logFile = new File( basedir, "build.log" );
+    System.out.println( "Checking for existence of build log: " + logFile );
+    if ( !logFile.exists() )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+
+    String log = FileUtils.fileRead( logFile );
+
+    System.out.println( "Checking for first build" );
+    int index = log.indexOf( "Building: project" );
+    if ( !log.substring( index, index + 18 ).equals( "Building: project3" ) )
+    {
+        System.out.println( "FAILED!\n" + log.substring( index, index + 18 ) );
+        return false;
+    }
+
+    System.out.println( "Checking for duplicate build" );
+    index = log.indexOf( "Building: project3", index + 1 );
+    if ( index >= 0 )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/project-setup/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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=686631&r1=686630&r2=686631&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 Sun Aug 17 11:55:30 2008
@@ -88,20 +88,19 @@
 {
 
     /**
-     * Flag used to suppress certain invocations. This is useful in tailoring the
-     * build using profiles.
-     *
+     * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles.
+     * 
      * @parameter default-value="false"
      * @since 1.1
      */
     private boolean skipInvocation;
 
     /**
-     * Flag used to suppress the summary output notifying of successes and failures. If set to <code>true</code>,
-     * the only indication of the build's success or failure will be the effect it has on the main
-     * build (if it fails, the main build should fail as well). If <code>streamLogs</code> is enabled, the sub-build
-     * summary will also provide an indication.
-     *
+     * Flag used to suppress the summary output notifying of successes and failures. If set to <code>true</code>, the
+     * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the
+     * main build should fail as well). If {@link #streamLogs} is enabled, the sub-build summary will also provide an
+     * indication.
+     * 
      * @parameter default-value="false"
      */
     private boolean suppressSummaries;
@@ -181,6 +180,18 @@
     private List pomExcludes = Collections.EMPTY_LIST;
 
     /**
+     * Include patterns for searching the projects directory for projects that need to be run before the other projects.
+     * This parameter allows to declare projects that perform setup tasks like installing utility artifacts into the
+     * local repository. Projects matched by these patterns are implicitly excluded from the scan for ordinary projects.
+     * Also, the exclusions defined by the parameter {@link #pomExcludes} apply to the setup projects, too. Default
+     * value is: <code>setup*&#47;pom.xml</code>.
+     * 
+     * @parameter
+     * @since 1.3
+     */
+    private List setupIncludes = Collections.singletonList( "setup*/pom.xml" );
+
+    /**
      * The list of goals to execute on each project. Default value is: <code>package</code>.
      *
      * @parameter
@@ -191,8 +202,8 @@
      * The name of the project-specific file that contains the enumeration of goals to execute for that test.
      * 
      * @parameter expression="${invoker.goalsFile}" default-value="goals.txt"
-     * @deprecated As of version 1.2, the key {@code invoker.goals} from the properties file specified by the parameter
-     *             {@link #invokerPropertiesFile} should be used instead.
+     * @deprecated As of version 1.2, the key <code>invoker.goals</code> from the properties file specified by the
+     *             parameter {@link #invokerPropertiesFile} should be used instead.
      */
     private String goalsFile;
 
@@ -300,10 +311,11 @@
 
     /**
      * A comma separated list of project names to run. Specify this parameter to run individual tests by file name,
-     * overriding the <code>pomIncludes</code> and <code>pomExcludes</code> parameters. Each pattern you specify here
-     * will be used to create an include pattern formatted like <code>${projectsDirectory}/<i>pattern</i></code>, so
-     * you can just type "-Dinvoker.test=FirstTest,SecondTest" to run builds in "${projectsDirectory}/FirstTest" and
-     * "${projectsDirectory}/SecondTest".
+     * overriding the {@link #setupIncludes}, {@link #pomIncludes} and {@link #pomExcludes} parameters. Each pattern you
+     * specify here will be used to create an include pattern formatted like
+     * <code>${projectsDirectory}/<i>pattern</i></code>, so you can just type
+     * <code>-Dinvoker.test=FirstTest,SecondTest</code> to run builds in <code>${projectsDirectory}/FirstTest</code> and
+     * <code>${projectsDirectory}/SecondTest</code>.
      * 
      * @parameter expression="${invoker.test}"
      * @since 1.1
@@ -312,11 +324,11 @@
 
     /**
      * 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>
+     * file exists and is empty no profiles will be used even if the parameter {@link #profiles} is set.</b>
      * 
      * @parameter expression="${invoker.profilesFile}" default-value="profiles.txt"
      * @since 1.1
-     * @deprecated As of version 1.2, the key {@code invoker.profiles} from the properties file specified by the
+     * @deprecated As of version 1.2, the key <code>invoker.profiles</code> from the properties file specified by the
      *             parameter {@link #invokerPropertiesFile} should be used instead.
      */
     private String profilesFile;
@@ -324,7 +336,7 @@
     /**
      * Path to an alternate <code>settings.xml</code> to use for Maven invocation with all ITs. Note that the
      * <code>&lt;localRepository&gt;</code> element of this settings file is always ignored, i.e. the path given by the
-     * parameter <code>localRepositoryPath</code> is dominant.
+     * parameter {@link #localRepositoryPath} is dominant.
      * 
      * @parameter expression="${invoker.settingsFile}"
      * @since 1.2
@@ -1405,7 +1417,8 @@
 
     /**
      * Gets the paths to the projects that should be build. Each path may either denote a POM file or merely a project
-     * base directory. The returned paths will be relative to the projects directory.
+     * base directory. The returned paths will be relative to the projects directory. Finally note that the order of the
+     * returned project paths is significant.
      * 
      * @return The paths to the projects that should be build, may be empty but never <code>null</code>.
      * @throws IOException If the projects directory could not be scanned.
@@ -1417,7 +1430,7 @@
 
         if ( ( pom != null ) && pom.exists() )
         {
-            poms = new String[]{ pom.getAbsolutePath() };
+            poms = new String[] { pom.getAbsolutePath() };
         }
         else if ( invokerTest != null )
         {
@@ -1430,20 +1443,7 @@
                 includes.add( testRegexes[i] );
             }
 
-            final FileSet fs = new FileSet();
-
-            fs.setIncludes( includes );
-            //fs.setExcludes( pomExcludes );
-            fs.setDirectory( projectsDirectory.getCanonicalPath() );
-            fs.setFollowSymlinks( false );
-            fs.setUseDefaultExcludes( true );
-
-            final FileSetManager fsm = new FileSetManager( getLog() );
-
-            List included = new ArrayList();
-            included.addAll( Arrays.asList( fsm.getIncludedFiles( fs ) ) );
-            included.addAll( Arrays.asList( fsm.getIncludedDirectories( fs ) ) );
-            poms = (String[]) included.toArray( new String[included.size()] );
+            poms = scanProjectsDirectory( includes, null );
         }
         else
         {
@@ -1458,59 +1458,82 @@
                 }
             }
 
-            final FileSet fs = new FileSet();
+            String[] setupPoms = scanProjectsDirectory( setupIncludes, excludes );
 
-            fs.setIncludes( pomIncludes );
-            fs.setExcludes( excludes );
-            fs.setDirectory( projectsDirectory.getCanonicalPath() );
-            fs.setFollowSymlinks( false );
-            fs.setUseDefaultExcludes( true );
+            excludes.addAll( setupIncludes );
+            String[] normalPoms = scanProjectsDirectory( pomIncludes, excludes );
 
-            final FileSetManager fsm = new FileSetManager( getLog() );
-
-            List included = new ArrayList();
-            included.addAll( Arrays.asList( fsm.getIncludedFiles( fs ) ) );
-            included.addAll( Arrays.asList( fsm.getIncludedDirectories( fs ) ) );
-            poms = (String[]) included.toArray( new String[included.size()] );
+            poms = new String[setupPoms.length + normalPoms.length];
+            System.arraycopy( setupPoms, 0, poms, 0, setupPoms.length );
+            System.arraycopy( normalPoms, 0, poms, setupPoms.length, normalPoms.length );
         }
 
-        poms = relativizePomPaths( poms );
+        poms = relativizeProjectPaths( poms );
 
         return poms;
     }
 
     /**
-     * Relativizes the specified POM paths against the directory specified by {@link #projectsDirectory} (if possible).
-     * If a POM path does not denote a sub path of the projects directory, it is returned as is.
+     * Scans the projects directory for projects to build. Both (POM) files and mere directories will be matched by the
+     * scanner patterns.
+     * 
+     * @param includes The include patterns for the scanner, may be <code>null</code>.
+     * @param excludes The exclude patterns for the scanner, may be <code>null</code> to exclude nothing.
+     * @return The relative paths to either POM files or project base directories, never <code>null</code>.
+     * @throws IOException If the project directory could not be scanned.
+     */
+    private String[] scanProjectsDirectory( List includes, List excludes )
+        throws IOException
+    {
+        final FileSet fs = new FileSet();
+
+        fs.setIncludes( includes );
+        fs.setExcludes( excludes );
+        fs.setDirectory( projectsDirectory.getCanonicalPath() );
+        fs.setFollowSymlinks( false );
+        fs.setUseDefaultExcludes( true );
+
+        final FileSetManager fsm = new FileSetManager( getLog() );
+
+        List included = new ArrayList();
+        included.addAll( Arrays.asList( fsm.getIncludedFiles( fs ) ) );
+        included.addAll( Arrays.asList( fsm.getIncludedDirectories( fs ) ) );
+
+        return (String[]) included.toArray( new String[included.size()] );
+    }
+
+    /**
+     * Relativizes the specified project paths against the directory specified by {@link #projectsDirectory} (if
+     * possible). If a project path does not denote a sub path of the projects directory, it is returned as is.
      * 
-     * @param pomPaths The POM paths to relativize, must not be <code>null</code> nor contain <code>null</code>
+     * @param projectPaths The project paths to relativize, must not be <code>null</code> nor contain <code>null</code>
      *            elements.
-     * @return The relativized POM paths, never <code>null</code>.
+     * @return The relativized project paths, never <code>null</code>.
      * @throws IOException If any path could not be relativized.
      */
-    private String[] relativizePomPaths( String[] pomPaths )
+    private String[] relativizeProjectPaths( String[] projectPaths )
         throws IOException
     {
         String projectsDirPath = projectsDirectory.getCanonicalPath();
 
-        String[] results = new String[pomPaths.length];
+        String[] results = new String[projectPaths.length];
 
-        for ( int i = 0; i < pomPaths.length; i++ )
+        for ( int i = 0; i < projectPaths.length; i++ )
         {
-            String pomPath = pomPaths[i];
+            String projectPath = projectPaths[i];
 
-            File pomFile = new File( pomPath );
+            File file = new File( projectPath );
 
-            if ( !pomFile.isAbsolute() )
+            if ( !file.isAbsolute() )
             {
-                pomFile = new File( projectsDirectory, pomPath );
+                file = new File( projectsDirectory, projectPath );
             }
 
-            String relativizedPath = relativizePath( pomFile, projectsDirPath );
+            String relativizedPath = relativizePath( file, projectsDirPath );
 
             if ( relativizedPath == null )
             {
-                relativizedPath = pomPath;
+                relativizedPath = projectPath;
             }
 
             results[i] = relativizedPath;

Added: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm?rev=686631&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm Sun Aug 17 11:55:30 2008
@@ -0,0 +1,75 @@
+ ------
+ Preparing the Build Environment
+ ------
+ Benjamin Bentmann
+ ------
+ 2008-08-17
+ ------
+
+ ~~ 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
+
+Preparing the Build Environment
+
+  In general, the plugin assumes that the projects to build are unrelated to one other such that their build order does
+  not matter. However, you might sometimes want to ensure that certain projects are build before others. As a
+  motivation, imagine that a project performs some kind of common setup for the other projects, e.g. installing utility
+  artifacts into the local repository.
+
+  Starting with plugin version 1.3, you can declare a group of setup projects that must be run before all the other
+  projects by means of the parameter <<<\<setupIncludes\>>>> as shown in the following example:
+
++----
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <setupIncludes>
+            <setupInclude>utility-plugin/pom.xml</setupInclude>
+          </setupIncludes>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
++----
+
+  This tells the plugin that the project <<<utility-plugin/pom.xml>>> must be run before the other projects selected by
+  the pattern <<<*/pom.xml>>>. Please note that although the pattern <<<*/pom.xml>>> also matches the path
+  <<<utility-plugin/pom.xml>>>, this project will not be run twice. In other words, any project selected by both
+  <<<\<setupIncludes\>>>> and <<<\<pomIncludes\>>>> will only be run once, namely during the setup phase.
+
+  The build order of several such setup projects is still undefined. So if the setup projects have inter-dependencies
+  that require a certain build order, you should group them by an aggregator POM and feed that into the Invoker Plugin
+  such that the correct build order will be determined by Maven's multi-module reactor.

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/site/apt/examples/prepare-build-env.apt.vm
------------------------------------------------------------------------------
    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=686631&r1=686630&r2=686631&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 17 11:55:30 2008
@@ -49,7 +49,7 @@
 
 * Examples
 
-  The following example configurations are available:
+  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.
 
@@ -63,4 +63,6 @@
 
   * {{{examples/invoker-properties.html}Using 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.
+
   []

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=686631&r1=686630&r2=686631&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 17 11:55:30 2008
@@ -36,6 +36,7 @@
       <item name="Installing Artifacts" href="examples/install-artifacts.html"/>
       <item name="Invoker Properties" href="examples/invoker-properties.html"/>
       <item name="Using a Post Build Script" href="examples/post-build-script.html"/>
+      <item name="Preparing the Build Environment" href="examples/prepare-build-env.html"/>
     </menu>
     
   </body>