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:
Trygve Laugstol 2005-08-18 12:13:47 +00:00
parent 3dcf43d418
commit bea3c7f17b
1 changed files with 15 additions and 15 deletions

View File

@ -5,6 +5,7 @@ package org.apache.maven.doxia;
import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Site;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
@ -72,7 +73,7 @@ public class ScpSiteDeployMojo
{ {
File baseDir = new File( inputDirectory ); File baseDir = new File( inputDirectory );
File zipFile = null; File zipFile;
try try
{ {
@ -90,33 +91,32 @@ public class ScpSiteDeployMojo
if ( distributionManagement == null ) if ( distributionManagement == null )
{ {
String msg = "distributionManagement element is missing in the POM: " + project.getId(); throw new MojoExecutionException( "Missing distribution management information in the project" );
throw new MojoExecutionException( msg );
} }
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( "Missing site information in the distribution management element in the project.." );
throw new MojoExecutionException( msg );
} }
String url = distributionManagement.getSite().getUrl(); String url = site.getUrl();
String id = distributionManagement.getSite().getId(); String id = site.getId();
if ( url == null ) if ( url == null )
{ {
String msg = "distributionManagement/site/url element is missing in the POM: " + project.getId(); throw new MojoExecutionException( "The URL to the site is missing in the project descriptor." );
throw new MojoExecutionException( msg );
} }
Repository repository = new Repository( id, url ); 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 = (SshCommandExecutor) wagonManager.getWagon( "scp" );
commandExecutor.connect( repository, wagonManager.getAuthenticationInfo( id ) ); commandExecutor.connect( repository, wagonManager.getAuthenticationInfo( id ) );