maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r1002882 - /maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java
Date Wed, 29 Sep 2010 22:43:58 GMT
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 );



Mime
View raw message