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 2010/09/30 00:43:58 UTC

svn commit: r1002882 - /maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java

Author: bentmann
Date: Wed Sep 29 22:43:58 2010
New Revision: 1002882

URL: http://svn.apache.org/viewvc?rev=1002882&view=rev
Log:
o Fixed tests to respect maven.repo.local

Modified:
    maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java

Modified: maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java?rev=1002882&r1=1002881&r2=1002882&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java (original)
+++ maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java Wed Sep 29 22:43:58 2010
@@ -31,10 +31,12 @@ import java.util.Properties;
 
 import org.apache.commons.io.filefilter.SuffixFileFilter;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.invoker.InvocationRequest;
 import org.apache.maven.shared.invoker.InvocationResult;
 import org.apache.maven.shared.test.plugin.BuildTool;
 import org.apache.maven.shared.test.plugin.TestToolsException;
 import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Tests {@code DefaultMavenRuntime}.
@@ -651,11 +653,25 @@ public class DefaultMavenRuntimeTest ext
         List<String> goals = Arrays.asList( new String[] { "clean", "package" } );
         File log = new File( pom.getParentFile(), "build.log" );
 
-        InvocationResult result = buildTool.executeMaven( pom, properties, goals, log );
+        InvocationRequest request = buildTool.createBasicInvocationRequest( pom, properties, goals, log );
+        request.setLocalRepositoryDirectory( findLocalRepo() );
+        InvocationResult result = buildTool.executeMaven( request );
         assertNull( "Error building test project", result.getExecutionException() );
         assertEquals( "Error building test project", 0, result.getExitCode() );
     }
 
+    private File findLocalRepo()
+    {
+        String basedir = System.getProperty( "maven.repo.local", "" );
+
+        if ( StringUtils.isNotEmpty( basedir ) )
+        {
+            return new File( basedir );
+        }
+
+        return null;
+    }
+
     private File getPackage( String pomPath )
     {
         File pom = getTestFile( "target/test-classes/", pomPath );