You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/08/25 23:01:06 UTC

svn commit: r569734 - /maven/plugins/trunk/maven-stage-plugin/src/main/java/org/apache/maven/plugins/stage/DefaultRepositoryCopier.java

Author: dennisl
Date: Sat Aug 25 14:01:05 2007
New Revision: 569734

URL: http://svn.apache.org/viewvc?rev=569734&view=rev
Log:
o Add INFO level logging to let the user know what the plugin is doing. If something fails during the coping we don't want to ask the user to rerun the plugin with debugging turned on.

Modified:
    maven/plugins/trunk/maven-stage-plugin/src/main/java/org/apache/maven/plugins/stage/DefaultRepositoryCopier.java

Modified: maven/plugins/trunk/maven-stage-plugin/src/main/java/org/apache/maven/plugins/stage/DefaultRepositoryCopier.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-stage-plugin/src/main/java/org/apache/maven/plugins/stage/DefaultRepositoryCopier.java?rev=569734&r1=569733&r2=569734&view=diff
==============================================================================
--- maven/plugins/trunk/maven-stage-plugin/src/main/java/org/apache/maven/plugins/stage/DefaultRepositoryCopier.java (original)
+++ maven/plugins/trunk/maven-stage-plugin/src/main/java/org/apache/maven/plugins/stage/DefaultRepositoryCopier.java Sat Aug 25 14:01:05 2007
@@ -99,9 +99,9 @@
     public void copy( String sourceRepositoryUrl, Repository targetRepository, String version, String username )
         throws WagonException, IOException
     {
-        String groupId = "staging-plugin";
+        String prefix = "staging-plugin";
 
-        String fileName = groupId + "-" + version + ".zip";
+        String fileName = prefix + "-" + version + ".zip";
 
         String tempdir = System.getProperty( "java.io.tmpdir" );
 
@@ -109,18 +109,20 @@
 
         // Create the renameScript script
 
-        String renameScriptName = groupId + "-" + version + "-rename.sh";
+        String renameScriptName = prefix + "-" + version + "-rename.sh";
 
         File renameScript = new File( tempdir, renameScriptName );
 
         // Work directory
 
-        File basedir = new File( tempdir, groupId + "-" + version );
+        File basedir = new File( tempdir, prefix + "-" + version );
 
         FileUtils.deleteDirectory( basedir );
 
         basedir.mkdirs();
 
+        logger.info( "Downloading files from source repository." );
+
         Repository sourceRepository = new Repository( "source", sourceRepositoryUrl );
 
         String protocol = sourceRepository.getProtocol();
@@ -151,10 +153,12 @@
 
         // ----------------------------------------------------------------------------
         // Now all the files are present locally and now we are going to grab the
-        // metadata files from the targetRepositoryUrl stage and pull those down locally
+        // metadata files from the targetRepositoryUrl and pull those down locally
         // so that we can merge the metadata.
         // ----------------------------------------------------------------------------
 
+        logger.info( "Downloading metadata from the target repository." );
+
         // TODO BUG for some reason it gets the wagon without authentication info
         Wagon targetWagon = wagonManager.getWagon( targetRepository );
 
@@ -209,6 +213,8 @@
         // Create the Zip file that we will deploy to the targetRepositoryUrl stage
         // ----------------------------------------------------------------------------
 
+        logger.info( "Creating zip file." );
+
         OutputStream os = new FileOutputStream( archive );
 
         ZipOutputStream zos = new ZipOutputStream( os );
@@ -219,6 +225,8 @@
         // Create the renameScript script. This is as atomic as we can
         // ----------------------------------------------------------------------------
 
+        logger.info( "Creating rename script." );
+
         for ( Iterator i = moveCommands.iterator(); i.hasNext(); )
         {
             String s = (String) i.next();
@@ -246,8 +254,12 @@
 
         // Push the Zip to the target system
 
+        logger.info( "Uploading zip file to the target repository." );
+
         targetWagon.put( archive, fileName );
 
+        logger.info( "Unpacking zip file on the target machine." );
+
         String targetRepoBaseDirectory = targetRepository.getBasedir();
 
         // We use the super quiet option here as all the noise seems to kill/stall the connection
@@ -256,13 +268,19 @@
 
         ( (ScpWagon) targetWagon ).executeCommand( command );
 
+        logger.info( "Deleting zip file from the target repository." );
+
         command = "rm -f " + targetRepoBaseDirectory + "/" + fileName;
 
         ( (ScpWagon) targetWagon ).executeCommand( command );
 
+        logger.info( "Running rename script on the target machine." );
+
         command = "cd " + targetRepoBaseDirectory + "; sh " + renameScriptName;
 
         ( (ScpWagon) targetWagon ).executeCommand( command );
+
+        logger.info( "Deleting rename script from the target repository." );
 
         command = "rm -f " + targetRepoBaseDirectory + "/" + renameScriptName;