You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/08/31 23:57:17 UTC

svn commit: r1379633 - in /maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish: AbstractScmPublishMojo.java ScmPublishPublishMojo.java

Author: olamy
Date: Fri Aug 31 21:57:17 2012
New Revision: 1379633

URL: http://svn.apache.org/viewvc?rev=1379633&view=rev
Log:
add version parameter to use branch for checkout: possible to deploy to gh-pages

Modified:
    maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
    maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java

Modified: maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java?rev=1379633&r1=1379632&r2=1379633&view=diff
==============================================================================
--- maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java (original)
+++ maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java Fri Aug 31 21:57:17 2012
@@ -26,6 +26,7 @@ import org.apache.maven.plugin.MojoExecu
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.scm.ScmBranch;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmResult;
@@ -52,22 +53,22 @@ public abstract class AbstractScmPublish
     /**
      * Location of the inventory file.
      */
-    @Parameter( property = "scmpublish.inventoryFile",
-               defaultValue = "${project.build.directory}/scmpublish-inventory.js" )
+    @Parameter ( property = "scmpublish.inventoryFile",
+                 defaultValue = "${project.build.directory}/scmpublish-inventory.js" )
     protected File inventoryFile;
 
     /**
      * Location of the scm publication tree.
      */
-    @Parameter( property = "scmpublish.pubScmUrl", defaultValue = "${project.distributionManagement.site.url}",
-               required = true )
+    @Parameter ( property = "scmpublish.pubScmUrl", defaultValue = "${project.distributionManagement.site.url}",
+                 required = true )
     protected String pubScmUrl;
 
     /**
      * Location where the scm check-out is done.
      */
-    @Parameter( property = "scmpublish.checkoutDirectory",
-               defaultValue = "${project.build.directory}/scmpublish-checkout" )
+    @Parameter ( property = "scmpublish.checkoutDirectory",
+                 defaultValue = "${project.build.directory}/scmpublish-checkout" )
     protected File checkoutDirectory;
 
     /**
@@ -103,13 +104,13 @@ public abstract class AbstractScmPublish
     /**
      * The SCM username to use.
      */
-    @Parameter( property = "username" )
+    @Parameter ( property = "username" )
     protected String username;
 
     /**
      * The SCM password to use.
      */
-    @Parameter( property = "password" )
+    @Parameter ( property = "password" )
     protected String password;
 
     /**
@@ -117,32 +118,32 @@ public abstract class AbstractScmPublish
      * with distributed SCMs which support the file:// protocol TODO: we should think about having the defaults for the
      * various SCM providers provided via modello!
      */
-    @Parameter( property = "localCheckout", defaultValue = "false" )
+    @Parameter ( property = "localCheckout", defaultValue = "false" )
     protected boolean localCheckout;
 
     /**
      * The outputEncoding parameter of the site plugin. This plugin will corrupt your site
      * if this does not match the value used by the site plugin.
      */
-    @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}" )
+    @Parameter ( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}" )
     protected String siteOutputEncoding;
 
     /**
      * if the checkout directory exists and this flag is activated the plugin will try an update rather
      * than delete then checkout
      */
-    @Parameter( property = "scmpublish.tryUpdate", defaultValue = "false" )
+    @Parameter ( property = "scmpublish.tryUpdate", defaultValue = "false" )
     protected boolean tryUpdate;
 
     /**
      * Do not delete files to the scm
      */
-    @Parameter( property = "scmpublish.skipDeletedFiles", defaultValue = "false" )
+    @Parameter ( property = "scmpublish.skipDeletedFiles", defaultValue = "false" )
     protected boolean skipDeletedFiles;
 
     /**
      */
-    @Parameter( defaultValue = "${basedir}", readonly = true )
+    @Parameter ( defaultValue = "${basedir}", readonly = true )
     protected File basedir;
 
     /**
@@ -162,6 +163,12 @@ public abstract class AbstractScmPublish
     @Parameter
     protected String[] ignorePathsToDelete;
 
+    /**
+     * for github you must configure with gh-pages
+     */
+    @Parameter ( property = "scmpublish.scm.version" )
+    protected String scmVersion;
+
     protected ScmProvider scmProvider;
 
     protected ScmRepository scmRepository;
@@ -253,7 +260,10 @@ public abstract class AbstractScmPublish
 
         if ( !checkoutDirectory.exists() )
         {
-            logInfo( "tryUpdate is configured but no local copy currently available so forcing checkout" );
+            if ( tryUpdate )
+            {
+                logInfo( "tryUpdate is configured but no local copy currently available so forcing checkout" );
+            }
             checkoutDirectory.mkdirs();
             forceCheckout = true;
         }
@@ -269,7 +279,16 @@ public abstract class AbstractScmPublish
             }
             else
             {
-                scmResult = scmProvider.checkOut( scmRepository, fileSet );
+                if ( scmVersion == null )
+                {
+                    scmResult = scmProvider.checkOut( scmRepository, fileSet );
+                }
+                else
+                {
+
+                    ScmBranch scmBranch = new ScmBranch( scmVersion );
+                    scmResult = scmProvider.checkOut( scmRepository, fileSet, scmBranch );
+                }
             }
         }
         catch ( ScmException e )

Modified: maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java?rev=1379633&r1=1379632&r2=1379633&view=diff
==============================================================================
--- maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java (original)
+++ maven/plugins/trunk/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java Fri Aug 31 21:57:17 2012
@@ -272,6 +272,7 @@ public class ScmPublishPublishMojo
         try
         {
             getLog().debug( "deleting files: " + deletedList );
+
             RemoveScmResult deleteResult =
                 scmProvider.remove( scmRepository, deletedFileSet, "Deleting obsolete site files." );
             if ( !deleteResult.isSuccess() )