You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2011/01/04 14:35:37 UTC

svn commit: r1055033 - /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java

Author: ltheussl
Date: Tue Jan  4 13:35:37 2011
New Revision: 1055033

URL: http://svn.apache.org/viewvc?rev=1055033&view=rev
Log:
refactor: extract method

Modified:
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1055033&r1=1055032&r2=1055033&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java Tue Jan  4 13:35:37 2011
@@ -138,11 +138,6 @@ public class SiteDeployMojo
     public void execute()
         throws MojoExecutionException
     {
-        if ( !inputDirectory.exists() )
-        {
-            throw new MojoExecutionException( "The site does not exist, please run site:site first" );
-        }
-
         DistributionManagement distributionManagement = project.getDistributionManagement();
 
         if ( distributionManagement == null )
@@ -167,9 +162,30 @@ public class SiteDeployMojo
             throw new MojoExecutionException( "The URL to the site is missing in the project descriptor." );
         }
         getLog().debug( "The site will be deployed to '" + url + "'");
+        getLog().debug( "Using credentials from repository '" + id + "'" );
 
-        Repository repository = new Repository( id, url );
+        deployTo( id, url );
+    }
 
+    /**
+     * Use wagon to deploy the generated site to a given repository.
+     *
+     * @param id the id that is used to look up credentials for the deploy. Not null.
+     * @param url a valid scm url to deploy to. Not null.
+     *
+     * @throws MojoExecutionException if the deploy fails.
+     *
+     * @since 2.3
+     */
+    protected void deployTo( final String id, final String url )
+            throws MojoExecutionException
+    {
+        if ( !inputDirectory.exists() )
+        {
+            throw new MojoExecutionException( "The site does not exist, please run site:site first" );
+        }
+
+        Repository repository = new Repository( id, url );
         // TODO: work on moving this into the deployer like the other deploy methods
 
         Wagon wagon;