Author: bentmann
Date: Sat Aug  9 14:04:46 2008
New Revision: 684345

URL: http://svn.apache.org/viewvc?rev=684345&view=rev
Log:
[MINVOKER-47] Test builds fail to locate staged artifacts when using custom 
settings and non-default local repo path

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/pom.xml  
 (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/settings.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh   
(with props)
Modified:
    maven/plugins/trunk/maven-invoker-plugin/src/it/pom-less-invocation/pom.xml
    maven/plugins/trunk/maven-invoker-plugin/src/it/project-cloning/pom.xml
    
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/local-repo-default/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/pom.xml?rev=684345&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/pom.xml 
(added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/pom.xml 
Sat Aug  9 14:04:46 2008
@@ -0,0 +1,64 @@
+<?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>local-repo-settings</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>
+    Test to check for MINVOKER-47, i.e. local repo path given by IT 
settings.xml must be ignored even if
+    plugin configuration does not specify a custom location.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <projectsDirectory>src/it</projectsDirectory>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <settingsFile>src/it/settings.xml</settingsFile>
+          <goals>
+            <goal>install</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/local-repo-default/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml?rev=684345&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/project/pom.xml
 Sat Aug  9 14:04:46 2008
@@ -0,0 +1,26 @@
+<?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.test</groupId>
+  <artifactId>unit</artifactId>
+  <packaging>pom</packaging>
+  <version>0.1-SNAPSHOT</version>
+</project>
\ No newline at end of file

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

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

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/settings.xml?rev=684345&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/settings.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/settings.xml
 Sat Aug  9 14:04:46 2008
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings>
+  <!-- This path must be ignored, the path from the plugin configuration is 
always dominant -->
+  <localRepository>@project.build.directory@/bad-repo</localRepository>
+  <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/local-repo-default/src/it/settings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/src/it/settings.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh?rev=684345&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh 
(added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh 
Sat Aug  9 14:04:46 2008
@@ -0,0 +1,20 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+try
+{
+    File badRepoDir = new File( basedir, "target/bad-repo" );
+    if ( badRepoDir.exists() )
+    {
+        System.out.println( "IT used wrong local repository: " + badRepoDir );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/local-repo-default/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-less-invocation/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/pom-less-invocation/pom.xml?rev=684345&r1=684344&r2=684345&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/pom-less-invocation/pom.xml 
(original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/pom-less-invocation/pom.xml 
Sat Aug  9 14:04:46 2008
@@ -26,6 +26,7 @@
   <groupId>org.apache.maven.plugins.invoker</groupId>
   <artifactId>pom-less-invocation</artifactId>
   <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
 
   <description>Test to check for support to launch Maven on a mere directory, 
i.e. without a POM</description>
 

Modified: 
maven/plugins/trunk/maven-invoker-plugin/src/it/project-cloning/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/project-cloning/pom.xml?rev=684345&r1=684344&r2=684345&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/project-cloning/pom.xml 
(original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/project-cloning/pom.xml Sat 
Aug  9 14:04:46 2008
@@ -26,6 +26,7 @@
   <groupId>org.apache.maven.plugins.invoker</groupId>
   <artifactId>project-cloning</artifactId>
   <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
 
   <description>Test to check for proper project cloning</description>
 

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=684345&r1=684344&r2=684345&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
 Sat Aug  9 14:04:46 2008
@@ -114,7 +114,7 @@
      * repository like <code>${project.build.directory}/it-repo</code>. 
Otherwise, your ordinary local repository will
      * be used, potentially soiling it with broken artifacts.
      * 
-     * @parameter expression="${invoker.localRepositoryPath}"
+     * @parameter expression="${invoker.localRepositoryPath}" 
default-value="${settings.localRepository}"
      */
     private File localRepositoryPath;
 
@@ -312,7 +312,9 @@
     private String profilesFile;
 
     /**
-     * Path to an alternate <code>settings.xml</code> to use for Maven 
invocation with all ITs.
+     * 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 expression="${invoker.settingsFile}"
      * @since 1.2
@@ -488,14 +490,9 @@
             projectsDir = cloneProjectsTo;
         }
 
-        if ( localRepositoryPath != null )
+        if ( !localRepositoryPath.exists() )
         {
-            getLog().debug( "Using local repository: " + localRepositoryPath );
-
-            if ( !localRepositoryPath.exists() )
-            {
-                localRepositoryPath.mkdirs();
-            }
+            localRepositoryPath.mkdirs();
         }
 
         final List failures = new ArrayList();
@@ -776,10 +773,7 @@
 
             final InvocationRequest request = new DefaultInvocationRequest();
 
-            if ( localRepositoryPath != null )
-            {
-                request.setLocalRepositoryDirectory( localRepositoryPath );
-            }
+            request.setLocalRepositoryDirectory( localRepositoryPath );
 
             if ( settingsFile != null )
             {


Reply via email to