Author: bentmann
Date: Fri Aug 15 03:25:52 2008
New Revision: 686188

URL: http://svn.apache.org/viewvc?rev=686188&view=rev
Log:
o Excluded settings.xml automatically from project scanning

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/pom.xml   
(with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/project/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/project/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml
   (with props)
Modified:
    
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/pom.xml?rev=686188&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/pom.xml 
(added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/pom.xml 
Fri Aug 15 03:25:52 2008
@@ -0,0 +1,75 @@
+<?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>settings-auto-exclude</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>
+    Test to check that the custom settings.xml is automatically excluded from 
the project scanner. This is a convenience
+    feature to support the following common directory layout
+      src/it/
+        project1/
+        project2/
+        settings.xml
+    in combination with the POM include pattern "*" required to select 
POM-less directories. Without excluding settings.xml,
+    it would be considered a POM and cause a build failure.
+  </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>
+          <pomIncludes>
+            <!-- intended to select all immediate sub directories but will 
also match the settings.xml -->
+            <pomInclude>*</pomInclude>
+          </pomIncludes>
+          <settingsFile>src/it/settings.xml</settingsFile>
+          <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/settings-auto-exclude/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/project/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/project/pom.xml?rev=686188&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/project/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/project/pom.xml
 Fri Aug 15 03:25:52 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>project</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/settings-auto-exclude/src/it/project/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml?rev=686188&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml
 Fri Aug 15 03:25:52 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>file://@localRepository@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>file://@localRepository@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/settings-auto-exclude/src/it/settings.xml
------------------------------------------------------------------------------
    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=686188&r1=686187&r2=686188&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
 Fri Aug 15 03:25:52 2008
@@ -168,8 +168,9 @@
     private List pomIncludes = Collections.singletonList( "*/pom.xml" );
 
     /**
-     * Exclude patterns for searching the integration test directory. This 
parameter is meant to be set from the POM.
-     * By default, no POM files are excluded.
+     * Exclude patterns for searching the integration test directory. This 
parameter is meant to be set from the POM. By
+     * default, no POM files are excluded. For the convenience of using an 
include pattern like <code>*</code>, the
+     * custom settings file specified by the parameter [EMAIL PROTECTED] 
#settingsFile} will always be excluded automatically.
      * 
      * @parameter
      */
@@ -197,22 +198,18 @@
     private Invoker invoker;
 
     /**
-     * Relative path of a pre-build hook BeanShell or Groovy script to run 
prior to executing the build. If the file
-     * extension is omitted (e.g. "prebuild"), the plugin searches for the 
file by trying out the known extensions
-     * ".bsh" and ".groovy".<br>
-     * <br>
-     * <em>Note:</em> Support for Groovy was added in version 1.3 of the 
plugin.
+     * Relative path of a pre-build hook script to run prior to executing the 
build. This script may be written with
+     * either BeanShell or Groovy (since 1.3). If the file extension is 
omitted (e.g. <code>prebuild</code>), the plugin
+     * searches for the file by trying out the well-known extensions 
<code>.bsh</code> and <code>.groovy</code>.
      * 
      * @parameter expression="${invoker.preBuildHookScript}" 
default-value="prebuild.bsh"
      */
     private String preBuildHookScript;
 
     /**
-     * Relative path of a cleanup/verification BeanShell or Groovy script to 
run after executing the build. If the file
-     * extension is omitted (e.g. "verify"), the plugin searches for the file 
by trying out the known extensions
-     * ".bsh" and ".groovy".<br>
-     * <br>
-     * <em>Note:</em> Support for Groovy was added in version 1.3 of the 
plugin.
+     * Relative path of a cleanup/verification hook script to run after 
executing the build. This script may be written
+     * with either BeanShell or Groovy (since 1.3). If the file extension is 
omitted (e.g. <code>verify</code>), the
+     * plugin searches for the file by trying out the well-known extensions 
<code>.bsh</code> and <code>.groovy</code>.
      * 
      * @parameter expression="${invoker.postBuildHookScript}" 
default-value="postbuild.bsh"
      */
@@ -1167,6 +1164,13 @@
         }
     }
 
+    /**
+     * 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.
+     * 
+     * @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.
+     */
     String[] getPoms()
         throws IOException
     {
@@ -1204,10 +1208,21 @@
         }
         else
         {
+            List excludes = ( pomExcludes != null ) ? new ArrayList( 
pomExcludes ) : new ArrayList();
+            if ( this.settingsFile != null )
+            {
+                String exclude = normalizePath( this.settingsFile, 
projectsDirectory.getCanonicalPath() );
+                if ( exclude != null )
+                {
+                    excludes.add( exclude.replace( '\\', '/' ) );
+                    getLog().debug( "Automatically excluded " + exclude + " 
from project scanning" );
+                }
+            }
+
             final FileSet fs = new FileSet();
 
             fs.setIncludes( pomIncludes );
-            fs.setExcludes( pomExcludes );
+            fs.setExcludes( excludes );
             fs.setDirectory( projectsDirectory.getCanonicalPath() );
             fs.setFollowSymlinks( false );
             fs.setUseDefaultExcludes( true );


Reply via email to