mirror of https://github.com/apache/maven.git
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:
parent
0c6a30ab10
commit
0299978e27
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
|
@ -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 <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 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 );
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue