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/25 00:17:53 UTC

svn commit: r1150501 - in /maven/plugins/trunk/maven-site-plugin: pom.xml src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java src/site/apt/examples/adding-deploy-protocol.apt.vm src/site/apt/index.apt

Author: hboutemy
Date: Sun Jul 24 22:17:51 2011
New Revision: 1150501

URL: http://svn.apache.org/viewvc?rev=1150501&view=rev
Log:
[MSITE-599] improved error message in case of unavailable deploy protocol, with a dedicated example page to show how to add a protocol

Added:
    maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm   (with props)
Modified:
    maven/plugins/trunk/maven-site-plugin/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
    maven/plugins/trunk/maven-site-plugin/src/site/apt/index.apt

Modified: maven/plugins/trunk/maven-site-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/pom.xml?rev=1150501&r1=1150500&r2=1150501&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-site-plugin/pom.xml Sun Jul 24 22:17:51 2011
@@ -337,42 +337,12 @@ under the License.
       <artifactId>wagon-provider-api</artifactId>
       <version>${wagonVersion}</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-file</artifactId>
-      <version>${wagonVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-http-lightweight</artifactId>
-      <version>${wagonVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-ssh</artifactId>
-      <version>${wagonVersion}</version>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-ssh-external</artifactId>
-      <version>${wagonVersion}</version>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-ftp</artifactId>
-      <version>${wagonVersion}</version>
-      <scope>runtime</scope>
-    </dependency>
 
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-webdav-jackrabbit</artifactId>
       <version>${wagonVersion}</version>
-      <scope>runtime</scope>
+      <scope>test</scope>
       <exclusions>
         <exclusion>
           <groupId>org.slf4j</groupId>
@@ -381,27 +351,6 @@ under the License.
       </exclusions>
     </dependency>
 
-    <dependency>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-scm</artifactId>
-      <version>${wagonVersion}</version>
-      <scope>runtime</scope>
-    </dependency>
-
-    <!-- adding at least svn -->
-    <dependency>
-      <groupId>org.apache.maven.scm</groupId>
-      <artifactId>maven-scm-api</artifactId>
-      <version>${scmVersion}</version>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.scm</groupId>
-      <artifactId>maven-scm-provider-svnexe</artifactId>
-      <version>${scmVersion}</version>
-      <scope>runtime</scope>
-    </dependency>
-
     <!-- Plexus -->
     <dependency>
       <groupId>org.codehaus.plexus</groupId>

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=1150501&r1=1150500&r2=1150501&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 Sun Jul 24 22:17:51 2011
@@ -260,7 +260,7 @@ public abstract class AbstractDeployMojo
         throws MojoExecutionException
     {
         // TODO: work on moving this into the deployer like the other deploy methods
-        final Wagon wagon = getWagon( repository, wagonManager );
+        final Wagon wagon = getWagon( repository, wagonManager, getLog() );
 
         try
         {
@@ -343,7 +343,7 @@ public abstract class AbstractDeployMojo
         return buildDirectory;
     }
 
-    private static Wagon getWagon( final Repository repository, final WagonManager manager )
+    private  Wagon getWagon( final Repository repository, final WagonManager manager, final Log log )
         throws MojoExecutionException
     {
         final Wagon wagon;
@@ -354,7 +354,13 @@ public abstract class AbstractDeployMojo
         }
         catch ( UnsupportedProtocolException e )
         {
-            throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );
+            log.error( "Unavailable protocol for site deployment: '" + repository.getProtocol() + "'" );
+
+            throw new MojoExecutionException(
+                                              this,
+                                              "Unavailable protocol for site deployment: '" + repository.getProtocol() + "'",
+                                              "To add a new protocol to site plugin, see "
+                                                  + "http://maven.apache.org/plugins/maven-site-plugin/examples/adding-deploy-protocol.html" );
         }
         catch ( TransferFailedException e )
         {

Added: maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm?rev=1150501&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm (added)
+++ maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm Sun Jul 24 22:17:51 2011
@@ -0,0 +1,64 @@
+ ------
+ Adding a Protocol to Deploy the Site
+ ------
+ Hervé Boutemy
+ ------
+ 2011-07-24
+ ------
+
+ ~~ Licensed to the Apache Software Foundation (ASF) under one
+ ~~ or more contributor license agreements.  See the NOTICE file
+ ~~ distributed with this work for additional information
+ ~~ regarding copyright ownership.  The ASF licenses this file
+ ~~ to you under the Apache License, Version 2.0 (the
+ ~~ "License"); you may not use this file except in compliance
+ ~~ with the License.  You may obtain a copy of the License at
+ ~~
+ ~~   http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing,
+ ~~ software distributed under the License is distributed on an
+ ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~~ KIND, either express or implied.  See the License for the
+ ~~ specific language governing permissions and limitations
+ ~~ under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
+
+Adding a Protocol to Deploy the Site 
+
+  Maven 3 - then Maven Site Plugin - comes with minimal built-in protocol support: <<<file>>>, <<<http>>>, <<<https>>>.
+  Maven 2 adds <<<scp>>> to this list.
+
+  To deploy a site with a non-built-in protocol, you'll need to add a new {{{http://maven.apache.org/wagon}wagon provider}}.
+
+  You can add it either as a global extension, or just let it at site plugin level:
+
++-----+
+<project>
+  ...
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>${project.version}</version>
+          <dependencies>
+            <dependencies>
+              <dependency><!-- add support for ssh/scp -->
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ssh</artifactId>
+                <version>1.0</version>
+              </dependency>
+            </dependencies>
+          </dependencies>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  ...
+</project>
++-----+

Propchange: maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/adding-deploy-protocol.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-site-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/site/apt/index.apt?rev=1150501&r1=1150500&r2=1150501&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-site-plugin/src/site/apt/index.apt Sun Jul 24 22:17:51 2011
@@ -97,6 +97,8 @@ Maven Site Plugin 3
 
    * {{{./examples/configuring-reports.html}Configuring Reports}}
 
+   * {{{./examples/adding-deploy-protocol.html}Adding a Protocol to Deploy the Site}}
+
    * {{{./examples/siterun.html}Configuring Site Run}}
 
    * {{{./examples/templatefile.html}Changing the Template File}}