maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r1079541 - in /maven/plugins/branches/maven-site-plugin-3.x: ./ src/it/top-parent-no-site/ src/it/top-parent-no-site/module1/ src/it/top-parent-no-site/root/ src/main/java/org/apache/maven/plugins/site/
Date Tue, 08 Mar 2011 21:06:27 GMT
Author: ltheussl
Date: Tue Mar  8 21:06:26 2011
New Revision: 1079541

URL: http://svn.apache.org/viewvc?rev=1079541&view=rev
Log:
merge r1079529 from trunk

Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/
      - copied from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/invoker.properties
      - copied, changed from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/invoker.properties
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/module1/
      - copied from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/module1/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/module1/pom.xml
      - copied unchanged from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/module1/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/pom.xml
      - copied unchanged from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/root/
      - copied from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/root/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/root/pom.xml
      - copied unchanged from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/root/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/verify.bsh
      - copied unchanged from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/verify.bsh
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/   (props changed)
    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/SiteDeployMojo.java
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java

Propchange: maven/plugins/branches/maven-site-plugin-3.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  8 21:06:26 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,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
+/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,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,1079529

Copied: maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/invoker.properties
(from r1079529, maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/invoker.properties)
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/invoker.properties?p2=maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/invoker.properties&p1=maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/invoker.properties&r1=1079529&r2=1079541&rev=1079541&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/top-parent-no-site/invoker.properties (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/top-parent-no-site/invoker.properties
Tue Mar  8 21:06:26 2011
@@ -1,3 +1,2 @@
-invoker.maven.version = 3.0-
 invoker.goals.1 = clean
 invoker.goals.2 = site:site site:deploy site:stage site:stage-deploy

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=1079541&r1=1079540&r2=1079541&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  8 21:06:26 2011
@@ -179,10 +179,11 @@ public abstract class AbstractDeployMojo
      *
      * @return a String starting with "/".
      */
-    protected String getDeployModuleDirectory()
+    private String getDeployModuleDirectory()
+        throws MojoExecutionException
     {
-        String relative = "/" + siteTool.getRelativePath( project.getDistributionManagement().getSite().getUrl(),
-            getTopLevelParent( project ).getDistributionManagement().getSite().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
@@ -620,7 +621,7 @@ public abstract class AbstractDeployMojo
      *
      * @return The top level project in the reactor, or <code>null</code> if
none can be found
      */
-    protected static MavenProject getTopLevelProject( List<MavenProject> reactorProjects
)
+    private static MavenProject getTopLevelProject( List<MavenProject> reactorProjects
)
     {
         if ( reactorProjects == null )
         {
@@ -639,30 +640,6 @@ public abstract class AbstractDeployMojo
     }
 
     /**
-     * Return the top level parent of the given project.
-     *
-     * @param project the MavenProject. May be null in which case null is returned.
-     *
-     * @return the upper-most parent MavenProject, or the original project if it has no parent.
-     */
-    protected static MavenProject getTopLevelParent( final MavenProject project )
-    {
-        if ( project == null )
-        {
-            return null;
-        }
-
-        MavenProject parent = project;
-
-        while ( parent.getParent() != null )
-        {
-            parent = parent.getParent();
-        }
-
-        return parent;
-    }
-
-    /**
      * Extract the distributionManagment site from the given MavenProject.
      *
      * @param project the MavenProject. Not null.
@@ -672,7 +649,7 @@ public abstract class AbstractDeployMojo
      *
      * @throws MojoExecutionException if any of the site info is missing.
      */
-    protected static Site getSite( final MavenProject project )
+    private static Site getSite( final MavenProject project )
         throws MojoExecutionException
     {
         final String name = project.getName() + " ("
@@ -700,4 +677,40 @@ public abstract class AbstractDeployMojo
 
         return site;
     }
+
+    /**
+     * Extract the distributionManagment site of the top level parent of the given MavenProject.
+     * This climbs up the project hirarchy and returns the site of the last project
+     * for which {@link #getSite(org.apache.maven.project.MavenProject)} returns a site.
+     *
+     * @param project the MavenProject. Not null.
+     *
+     * @return the top level site. Not null.
+     *      Also site.getUrl() and site.getId() are guaranteed to be not null.
+     *
+     * @throws MojoExecutionException if no site info is found in the tree.
+     */
+    protected static Site getRootSite( MavenProject project )
+        throws MojoExecutionException
+    {
+        Site site = getSite( project );
+
+        MavenProject parent = project;
+
+        while ( parent.getParent() != null )
+        {
+            parent = parent.getParent();
+
+            try
+            {
+                site = getSite( parent );
+            }
+            catch ( MojoExecutionException e )
+            {
+                break;
+            }
+        }
+
+        return site;
+    }
 }

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=1079541&r1=1079540&r2=1079541&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
(original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
Tue Mar  8 21:06:26 2011
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.site;
 
 import org.apache.maven.model.Site;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
 
 /**
  * Deploys the generated site using <code>scp</code> or <code>file</code>
@@ -49,7 +50,7 @@ public class SiteDeployMojo
     {
         if ( site == null )
         {
-            site = getSite( getTopLevelParent( project ) );
+            site = getRootSite( project );
         }
 
         return site.getId();
@@ -61,7 +62,7 @@ public class SiteDeployMojo
     {
         if ( site == null )
         {
-            site = getSite( getTopLevelParent( project ) );
+            site = getRootSite( project );
         }
 
         return site.getUrl();

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=1079541&r1=1079540&r2=1079541&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  8 21:06:26 2011
@@ -108,7 +108,7 @@ public class SiteStageDeployMojo
         {
             // The user didn't specify a URL, use the top level target dir
             topLevelURL =
-                getSite( getTopLevelParent( project ) ).getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
+                getRootSite( project ).getUrl() + "/" + DEFAULT_STAGING_DIRECTORY;
             getLog().debug( "stagingSiteURL NOT specified, using the top level project: "
+ topLevelURL );
         }
 



Mime
View raw message