mirror of https://github.com/apache/maven.git
o Throwing an exception if the procotol isn't 'scp' as that's the only protocol
this provider currently supports. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@233310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3dcf43d418
commit
bea3c7f17b
|
@ -5,6 +5,7 @@ package org.apache.maven.doxia;
|
|||
|
||||
import org.apache.maven.artifact.manager.WagonManager;
|
||||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.model.Site;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
@ -72,7 +73,7 @@ public class ScpSiteDeployMojo
|
|||
{
|
||||
File baseDir = new File( inputDirectory );
|
||||
|
||||
File zipFile = null;
|
||||
File zipFile;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -90,33 +91,32 @@ public class ScpSiteDeployMojo
|
|||
|
||||
if ( distributionManagement == null )
|
||||
{
|
||||
String msg = "distributionManagement element is missing in the POM: " + project.getId();
|
||||
|
||||
throw new MojoExecutionException( msg );
|
||||
throw new MojoExecutionException( "Missing distribution management information in the project" );
|
||||
}
|
||||
|
||||
if ( distributionManagement.getSite() == null )
|
||||
Site site = distributionManagement.getSite();
|
||||
|
||||
if ( site == null )
|
||||
{
|
||||
String msg = "distributionManagement/site element is missing in the POM: " + project.getId();
|
||||
|
||||
throw new MojoExecutionException( msg );
|
||||
|
||||
throw new MojoExecutionException( "Missing site information in the distribution management element in the project.." );
|
||||
}
|
||||
|
||||
String url = distributionManagement.getSite().getUrl();
|
||||
String url = site.getUrl();
|
||||
|
||||
String id = distributionManagement.getSite().getId();
|
||||
String id = site.getId();
|
||||
|
||||
if ( url == null )
|
||||
{
|
||||
String msg = "distributionManagement/site/url element is missing in the POM: " + project.getId();
|
||||
|
||||
throw new MojoExecutionException( msg );
|
||||
|
||||
throw new MojoExecutionException( "The URL to the site is missing in the project descriptor." );
|
||||
}
|
||||
|
||||
Repository repository = new Repository( id, url );
|
||||
|
||||
if ( !"scp".equals( repository.getProtocol() ) )
|
||||
{
|
||||
throw new MojoExecutionException( "The deploy mojo currently only supports site deployment using the 'scp' protocol." );
|
||||
}
|
||||
|
||||
commandExecutor = (SshCommandExecutor) wagonManager.getWagon( "scp" );
|
||||
|
||||
commandExecutor.connect( repository, wagonManager.getAuthenticationInfo( id ) );
|
||||
|
|
Loading…
Reference in New Issue