You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/07/26 23:55:21 UTC

svn commit: r1151264 - /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java

Author: hboutemy
Date: Tue Jul 26 21:55:20 2011
New Revision: 1151264

URL: http://svn.apache.org/viewvc?rev=1151264&view=rev
Log:
added a list of supported protocols

Modified:
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1151264&r1=1151263&r2=1151264&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Tue Jul 26 21:55:20 2011
@@ -25,6 +25,7 @@ import java.net.URL;
 
 import java.util.List;
 import java.util.Locale;
+import java.util.Set;
 
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.execution.MavenExecutionRequest;
@@ -343,7 +344,7 @@ public abstract class AbstractDeployMojo
         return buildDirectory;
     }
 
-    private static Wagon getWagon( final Repository repository, final WagonManager manager, final Log log )
+    private Wagon getWagon( final Repository repository, final WagonManager manager, final Log log )
         throws MojoExecutionException
     {
         final Wagon wagon;
@@ -354,12 +355,13 @@ public abstract class AbstractDeployMojo
         }
         catch ( UnsupportedProtocolException e )
         {
-            log.error( "Unsupported protocol for site deployment: '" + repository.getProtocol()
-                + "'. For adding new protocols to the site plugin, see "
+            log.error( "Unsupported protocol for site deployment: '" + repository.getProtocol() + "'." );
+            log.error( "Supported protocols at this moment: " + getSupportedProtocols() + "." );
+            log.error( "For adding new protocols to the site plugin, see "
                 + "http://maven.apache.org/plugins/maven-site-plugin/examples/adding-deploy-protocol.html" );
 
-            throw new MojoExecutionException( "Unsupported protocol for site deployment: '"
-                + repository.getProtocol() + "'.", e );
+            throw new MojoExecutionException( "Unsupported protocol for site deployment: '" + repository.getProtocol()
+                + "'.", e );
         }
         catch ( TransferFailedException e )
         {
@@ -375,6 +377,21 @@ public abstract class AbstractDeployMojo
         return wagon;
     }
 
+    private String getSupportedProtocols()
+    {
+        try
+        {
+            Set<String> protocols = container.lookupMap( Wagon.class ).keySet();
+
+            return StringUtils.join( protocols.iterator(), ", " );
+        }
+        catch ( ComponentLookupException e )
+        {
+            // ignore
+        }
+        return "";
+    }
+
     private static void push( final File inputDirectory, final Repository repository, final WagonManager manager,
                               final Wagon wagon, final ProxyInfo proxyInfo, final List<Locale> localesList,
                               final String relativeDir, final Log log )