You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2011/03/29 12:09:16 UTC

svn commit: r1086534 - in /maven/plugins/branches/maven-site-plugin-3.x: ./ src/main/java/org/apache/maven/plugins/site/

Author: ltheussl
Date: Tue Mar 29 10:09:16 2011
New Revision: 1086534

URL: http://svn.apache.org/viewvc?rev=1086534&view=rev
Log:
merge r1086313 and r1086533 from trunk

Modified:
    maven/plugins/branches/maven-site-plugin-3.x/   (props changed)
    maven/plugins/branches/maven-site-plugin-3.x/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java

Propchange: maven/plugins/branches/maven-site-plugin-3.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 29 10:09:16 2011
@@ -1 +1 @@
-/maven/plugins/trunk/maven-site-plugin:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1039748-1039749,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582,1066038,1067103,1067120,1070079-1070080,1070100,1070104,1074118,1075018,1075782,1075810,1075995,1076167,1076195,1077911,1077924,1078235,1079474,1079529,1079698,1080781,1081676,1081837,1081887,1082091,1082242,1082274,1082877,1083147,1083251,1083473,1084564,1086338-1086339
+/maven/plugins/trunk/maven-site-plugin:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1039748-1039749,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582,1066038,1067103,1067120,1070079-1070080,1070100,1070104,1074118,1075018,1075782,1075810,1075995,1076167,1076195,1077911,1077924,1078235,1079474,1079529,1079698,1080781,1081676,1081837,1081887,1082091,1082242,1082274,1082877,1083147,1083251,1083473,1084564,1086313,1086338-1086339,1086533

Modified: maven/plugins/branches/maven-site-plugin-3.x/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/pom.xml?rev=1086534&r1=1086533&r2=1086534&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/pom.xml Tue Mar 29 10:09:16 2011
@@ -159,6 +159,13 @@ under the License.
         <role>Russian translator</role>
       </roles>
     </contributor>
+    <contributor>
+      <name>Daniel Fernández</name>
+      <email>daniel.fernandez.garrido@gmail.com</email>
+      <roles>
+        <role>Galician translator</role>
+      </roles>
+    </contributor>
   </contributors>
 
   <prerequisites>

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1086534&r1=1086533&r2=1086534&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Tue Mar 29 10:09:16 2011
@@ -138,12 +138,38 @@ public abstract class AbstractDeployMojo
 
     private PlexusContainer container;
 
+    /**
+     * The String "staging/".
+     */
+    protected static final String DEFAULT_STAGING_DIRECTORY = "staging/";
+
     /** {@inheritDoc} */
     public void execute()
         throws MojoExecutionException
     {
-        deployTo( new org.apache.maven.plugins.site.wagon.repository.Repository( getDeployRepositoryID(),
-                                                                                 getDeployRepositoryURL() ) );
+        deployTo( new org.apache.maven.plugins.site.wagon.repository.Repository(
+            getDeployRepositoryID(),
+            appendSlash( getDeployRepositoryURL() ) ) );
+    }
+
+    /**
+     * Make sure the given url ends with a slash.
+     *
+     * @param url a String.
+     *
+     * @return if url already ends with '/' it is returned unchanged,
+     *      otherwise a '/' character is appended.
+     */
+    protected static String appendSlash( final String url )
+    {
+        if ( url.endsWith( "/" ) )
+        {
+            return url;
+        }
+        else
+        {
+            return url + "/";
+        }
     }
 
     /**
@@ -172,19 +198,21 @@ public abstract class AbstractDeployMojo
     /**
      * Find the relative path between the distribution URLs of the top parent and the current project.
      *
-     * @return a String starting with "/".
+     * @return the relative path or "./" if the two URLs are the same.
      *
      * @throws MojoExecutionException
      */
     private String getDeployModuleDirectory()
         throws MojoExecutionException
     {
-        String relative = "/" + siteTool.getRelativePath( getSite( project ).getUrl(),
+        String relative = siteTool.getRelativePath( getSite( project ).getUrl(),
             getRootSite( project ).getUrl() );
 
         // SiteTool.getRelativePath() uses File.separatorChar,
         // so we need to convert '\' to '/' in order for the URL to be valid for Windows users
-        return relative.replace( '\\', '/' );
+        relative = relative.replace( '\\', '/' );
+
+        return ( "".equals( relative ) ) ? "./" : relative;
     }
 
     /**
@@ -372,14 +400,16 @@ public abstract class AbstractDeployMojo
                 {
                     // TODO: this also uploads the non-default locales,
                     // is there a way to exclude directories in wagon?
+                    log.info( "   >>> to " + repository.getUrl() + relativeDir );
+
                     wagon.putDirectory( inputDirectory, relativeDir );
-                    log.info( "   to " + repository.getUrl() + relativeDir + ": done" );
                 }
                 else
                 {
+                    log.info( "   >>> to " + repository.getUrl() + locale.getLanguage() + "/" + relativeDir );
+
                     wagon.putDirectory( new File( inputDirectory, locale.getLanguage() ),
-                        locale.getLanguage() + relativeDir );
-                    log.info( "   to " + repository.getUrl() + locale.getLanguage() + relativeDir + ": done" );
+                        locale.getLanguage() + "/" + relativeDir );
                 }
             }
         }

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1086534&r1=1086533&r2=1086534&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java Tue Mar 29 10:09:16 2011
@@ -64,9 +64,6 @@ public class SiteStageDeployMojo
      */
     private String stagingRepositoryId;
 
-    private static final String DEFAULT_STAGING_DIRECTORY = "staging";
-
-
     @Override
     protected String getDeployRepositoryID()
         throws MojoExecutionException
@@ -106,8 +103,8 @@ public class SiteStageDeployMojo
         else
         {
             // The user didn't specify a URL, use the top level target dir
-            topLevelURL =
-                getRootSite( project ).getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
+            topLevelURL = appendSlash( getRootSite( project ).getUrl() )
+                + DEFAULT_STAGING_DIRECTORY;
             getLog().debug( "stagingSiteURL NOT specified, using the top level project: " + topLevelURL );
         }
 

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java?rev=1086534&r1=1086533&r2=1086534&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java Tue Mar 29 10:09:16 2011
@@ -40,8 +40,6 @@ import org.apache.maven.plugin.MojoExecu
 public class SiteStageMojo
     extends AbstractDeployMojo
 {
-    protected static final String DEFAULT_STAGING_DIRECTORY = "staging";
-
     /**
      * Staging directory location. This needs to be an absolute path, like
      * <code>C:\stagingArea\myProject\</code> on Windows or