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
This commit is contained in:
Brett Leslie Porter 2005-05-12 06:51:55 +00:00
parent 0c6a30ab10
commit 0299978e27
6 changed files with 38 additions and 21 deletions

View File

@ -422,17 +422,17 @@ private void releaseWagon( Wagon wagon )
}
}
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 );
}

View File

@ -23,6 +23,8 @@
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 @@ void addAuthenticationInfo( String repositoryId, String username, String passwor
void addMirror( String id, String mirrorOf, String url );
void setDownloadMonitor( TransferListener downloadMonitor );
ProxyInfo getProxy( String protocol );
AuthenticationInfo getAuthenticationInfo( String id );
}

View File

@ -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 @@
/**
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
* @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 <a href="mailto:michal@codehaus.org">Michal Maczka</a>
* @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 void execute()
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 void execute()
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 void execute()
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 void execute()
commandExecutor.executeCommand( rmCommand );
}
catch( Exception e )
catch ( Exception e )
{
throw new MojoExecutionException( "Error transfering site archive!", e );
}

View File

@ -64,6 +64,10 @@
-->
<url>scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2</url>
</repository>
<site>
<id>website</id>
<url>scp://minotaur.apache.org/www/maven.apache.org/maven2/plugins/</url>
</site>
</distributionManagement>
<modules>
<module>maven-assembly-plugin</module>

View File

@ -12,7 +12,7 @@
<distributionManagement>
<site>
<id>website</id>
<url>scp://people.apache.org/home/brett/public_html/maven-stage-site/maven2</url>
<url>scp://minotaur.apache.org/www/maven.apache.org/maven2</url>
</site>
</distributionManagement>
</project>

View File

@ -96,6 +96,10 @@
-->
<url>scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2</url>
</repository>
<site>
<id>website</id>
<url>scp://minotaur.apache.org/www/maven.apache.org/maven2</url>
</site>
</distributionManagement>
<modules>
<module>maven-archiver</module>