From bea3c7f17b6ab7102d0ea2332f14b9a1604e4e2e Mon Sep 17 00:00:00 2001 From: Trygve Laugstol Date: Thu, 18 Aug 2005 12:13:47 +0000 Subject: [PATCH] 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 --- .../apache/maven/doxia/ScpSiteDeployMojo.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) 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 e910b8f721..dc2a1aecc7 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 @@ -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 ) );