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/03/06 09:08:01 UTC
svn commit: r1078419 - in /maven/plugins/branches/maven-site-plugin-3.x: ./
src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
Author: ltheussl
Date: Sun Mar 6 08:08:01 2011
New Revision: 1078419
URL: http://svn.apache.org/viewvc?rev=1078419&view=rev
Log:
merge r1065582 from trunk
Modified:
maven/plugins/branches/maven-site-plugin-3.x/ (props changed)
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
Propchange: maven/plugins/branches/maven-site-plugin-3.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Mar 6 08:08:01 2011
@@ -1 +1 @@
-/maven/plugins/trunk/maven-site-plugin:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576
+/maven/plugins/trunk/maven-site-plugin:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582
Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1078419&r1=1078418&r2=1078419&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java Sun Mar 6 08:08:01 2011
@@ -19,12 +19,8 @@ package org.apache.maven.plugins.site;
* under the License.
*/
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
import org.apache.commons.lang.StringUtils;
+
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
@@ -54,6 +50,7 @@ import org.apache.maven.wagon.authorizat
import org.apache.maven.wagon.observers.Debug;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.repository.Repository;
+
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
@@ -64,6 +61,11 @@ import org.codehaus.plexus.configuration
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
/**
* Deploys the generated site using <code>scp</code> or <code>file</code>
* protocol to the site URL specified in the
@@ -163,33 +165,15 @@ public class SiteDeployMojo
public void execute()
throws MojoExecutionException
{
- DistributionManagement distributionManagement = project.getDistributionManagement();
-
- if ( distributionManagement == null )
- {
- throw new MojoExecutionException( "Missing distribution management information in the project" );
- }
+ final Site site = getSite( project );
- Site site = distributionManagement.getSite();
-
- if ( site == null )
+ if ( getLog().isDebugEnabled() )
{
- throw new MojoExecutionException(
- "Missing site information in the distribution management element in the project.." );
+ getLog().debug( "The site will be deployed to '" + site.getUrl() + "'");
+ getLog().debug( "Using credentials from repository '" + site.getId() + "'" );
}
- String url = site.getUrl();
-
- String id = site.getId();
-
- if ( url == null )
- {
- throw new MojoExecutionException( "The URL to the site is missing in the project descriptor." );
- }
- getLog().debug( "The site will be deployed to url '" + url + "' with id '" + id + "'");
- getLog().debug( "Using credentials from repository '" + id + "'" );
-
- deployTo( id, url );
+ deployTo( site.getId(), site.getUrl() );
}
/**
@@ -519,4 +503,29 @@ public class SiteDeployMojo
}
}
+ private static Site getSite( final MavenProject project )
+ throws MojoExecutionException
+ {
+ final DistributionManagement distributionManagement = project.getDistributionManagement();
+
+ if ( distributionManagement == null )
+ {
+ throw new MojoExecutionException( "Missing distribution management information in the project." );
+ }
+
+ final Site site = distributionManagement.getSite();
+
+ if ( site == null )
+ {
+ throw new MojoExecutionException(
+ "Missing site information in the distribution management element in the project." );
+ }
+
+ if ( site.getUrl() == null || site.getId() == null )
+ {
+ throw new MojoExecutionException( "Missing site data for deploy: specify url and id!" );
+ }
+
+ return site;
+ }
}