maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r489252 - /maven/shared/trunk/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java
Date Thu, 21 Dec 2006 02:58:19 GMT
Author: jdcasey
Date: Wed Dec 20 18:58:18 2006
New Revision: 489252

URL: http://svn.apache.org/viewvc?view=rev&rev=489252
Log:
Adding code to move the test-time local repo out of the way so the target dir can be cleaned,
then move it back to its original location.

Modified:
    maven/shared/trunk/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java

Modified: maven/shared/trunk/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java?view=diff&rev=489252&r1=489251&r2=489252
==============================================================================
--- maven/shared/trunk/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java
(original)
+++ maven/shared/trunk/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java
Wed Dec 20 18:58:18 2006
@@ -19,10 +19,12 @@
 package org.apache.maven.shared.test.plugin;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Collections;
 import java.util.Properties;
 
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
 
 /**
  * Test tool that provides a single point of access for staging a plugin artifact - along
with its
@@ -132,7 +134,10 @@
         File pomFile = new File( "pom.xml" );
         File buildLog = new File( "target/test-build-logs/setup.build.log" );
         File cleanLog = new File( "target/test-build-logs/setup.clean.log" );
+        
         File localRepoDir = localRepositoryDir;
+        
+        File tmpLocalRepoDir = new File( "test-local-repository" );
 
         if ( localRepoDir == null )
         {
@@ -142,7 +147,27 @@
         MavenProject project = projectTool.packageProjectArtifact( pomFile, testVersion,
skipUnitTests, buildLog );
         repositoryTool.createLocalRepositoryFromPlugin( project, localRepoDir );
         
+        try
+        {
+            FileUtils.copyDirectory( localRepoDir, tmpLocalRepoDir );
+        }
+        catch ( IOException e )
+        {
+            throw new TestToolsException( "Failed to move testing local repository out of
the way before cleaning the target dir." );
+        }
+        
         buildTool.executeMaven( pomFile, new Properties(), Collections.singletonList( "clean"
), cleanLog );
+        
+        localRepoDir.mkdirs();
+        try
+        {
+            FileUtils.copyDirectory( tmpLocalRepoDir, localRepoDir );
+            FileUtils.deleteDirectory( tmpLocalRepoDir );
+        }
+        catch ( IOException e )
+        {
+            throw new TestToolsException( "Failed to move testing local repository back to
it's specified location after cleaning the target dir." );
+        }
 
         return localRepoDir;
     }



Mime
View raw message