From 0299978e2786be55e755b949f8cbb3d4dd3f6478 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Thu, 12 May 2005 06:51:55 +0000 Subject: [PATCH] set the site deployment to the live environment, and use the wagon manager to get the authentication credentials git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169781 13f79535-47bb-0310-9956-ffa450edef68 --- .../artifact/manager/DefaultWagonManager.java | 6 +-- .../maven/artifact/manager/WagonManager.java | 6 +++ .../apache/maven/doxia/ScpSiteDeployMojo.java | 37 ++++++++++--------- maven-plugins/pom.xml | 4 ++ maven-site/pom.xml | 2 +- pom.xml | 4 ++ 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java index 1abd773a84..b6cc834965 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java @@ -422,17 +422,17 @@ public class DefaultWagonManager } } - private ProxyInfo getProxy( String protocol ) + public ProxyInfo getProxy( String protocol ) { return (ProxyInfo) proxies.get( protocol ); } - private AuthenticationInfo getAuthenticationInfo( String id ) + public AuthenticationInfo getAuthenticationInfo( String id ) { return (AuthenticationInfo) authenticationInfoMap.get( id ); } - private Repository getMirror( String mirrorOf ) + public Repository getMirror( String mirrorOf ) { return (Repository) mirrors.get( mirrorOf ); } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java index 3364f80470..a5789e9520 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java @@ -23,6 +23,8 @@ import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.UnsupportedProtocolException; import org.apache.maven.wagon.Wagon; +import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.events.TransferListener; import java.io.File; @@ -62,4 +64,8 @@ public interface WagonManager void addMirror( String id, String mirrorOf, String url ); void setDownloadMonitor( TransferListener downloadMonitor ); + + ProxyInfo getProxy( String protocol ); + + AuthenticationInfo getAuthenticationInfo( String id ); } \ No newline at end of file diff --git a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java index 83ec0418be..2059e6b706 100644 --- a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java +++ b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java @@ -3,6 +3,7 @@ */ package org.apache.maven.doxia; +import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.model.DistributionManagement; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -25,14 +26,14 @@ import java.util.zip.ZipOutputStream; /** - * @author Michal Maczka - * @version $Id$ - * @goal deploy - * @description deploys website using scp protocol. + * Deploys website using scp protocol. * First website files are packaged into zip archive, * then archive is transfred to remote host, nextly it is un-archived. * This method of deployment should normally be much faster * then making file by file copy. + * @author Michal Maczka + * @version $Id$ + * @goal deploy */ public class ScpSiteDeployMojo extends AbstractMojo @@ -61,6 +62,13 @@ public class ScpSiteDeployMojo */ private MavenProject project; + /** + * @parameter expression="${component.org.apache.maven.artifact.manager.WagonManager}" + * @required + * @readonly + */ + private WagonManager wagonManager; + public void execute() throws MojoExecutionException { @@ -77,26 +85,21 @@ public class ScpSiteDeployMojo throw new MojoExecutionException( "Cannot create site archive!", e ); } - SshCommandExecutor commandExecutor = new ScpWagon(); - + SshCommandExecutor commandExecutor = null; try { DistributionManagement distributionManagement = project.getDistributionManagement(); if ( distributionManagement == null ) { - - String msg = "distributionManagement element is missing in the POM: " - + project.getId(); + String msg = "distributionManagement element is missing in the POM: " + project.getId(); throw new MojoExecutionException( msg ); - } if ( distributionManagement.getSite() == null ) { - String msg = "distributionManagement/repository element is missing in the POM: " - + project.getId(); + String msg = "distributionManagement/site element is missing in the POM: " + project.getId(); throw new MojoExecutionException( msg ); @@ -108,8 +111,7 @@ public class ScpSiteDeployMojo if ( url == null ) { - String msg = "distributionManagement/site/url element is missing in the POM: " - + project.getId(); + String msg = "distributionManagement/site/url element is missing in the POM: " + project.getId(); throw new MojoExecutionException( msg ); @@ -117,8 +119,9 @@ public class ScpSiteDeployMojo Repository repository = new Repository( id, url ); - //@todo dirty hack to make artifact uploading work - commandExecutor.connect( repository, WagonUtils.getAuthInfo() ); + commandExecutor = (SshCommandExecutor) wagonManager.getWagon( "scp" ); + + commandExecutor.connect( repository, wagonManager.getAuthenticationInfo( id ) ); String basedir = repository.getBasedir(); @@ -147,7 +150,7 @@ public class ScpSiteDeployMojo commandExecutor.executeCommand( rmCommand ); } - catch( Exception e ) + catch ( Exception e ) { throw new MojoExecutionException( "Error transfering site archive!", e ); } diff --git a/maven-plugins/pom.xml b/maven-plugins/pom.xml index 378d0fa479..65de169a05 100644 --- a/maven-plugins/pom.xml +++ b/maven-plugins/pom.xml @@ -64,6 +64,10 @@ --> scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2 + + website + scp://minotaur.apache.org/www/maven.apache.org/maven2/plugins/ + maven-assembly-plugin diff --git a/maven-site/pom.xml b/maven-site/pom.xml index f072c23ab0..0a655379a8 100644 --- a/maven-site/pom.xml +++ b/maven-site/pom.xml @@ -12,7 +12,7 @@ website - scp://people.apache.org/home/brett/public_html/maven-stage-site/maven2 + scp://minotaur.apache.org/www/maven.apache.org/maven2 diff --git a/pom.xml b/pom.xml index e2c7c9a3ef..4a9c5b6183 100644 --- a/pom.xml +++ b/pom.xml @@ -96,6 +96,10 @@ --> scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2 + + website + scp://minotaur.apache.org/www/maven.apache.org/maven2 + maven-archiver