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 2013/05/09 22:07:32 UTC
svn commit: r1480752 - in /maven/plugins/trunk/maven-site-plugin/src:
it/site-sd-top-parent-same-site/pom.xml
main/java/org/apache/maven/plugins/site/AbstractStagingMojo.java
main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
Author: hboutemy
Date: Thu May 9 20:07:32 2013
New Revision: 1480752
URL: http://svn.apache.org/r1480752
Log:
[MSITE-687] added new topSiteURL parameter for staging mojos to override calculated value
Modified:
maven/plugins/trunk/maven-site-plugin/src/it/site-sd-top-parent-same-site/pom.xml
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractStagingMojo.java
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
Modified: maven/plugins/trunk/maven-site-plugin/src/it/site-sd-top-parent-same-site/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-sd-top-parent-same-site/pom.xml?rev=1480752&r1=1480751&r2=1480752&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/site-sd-top-parent-same-site/pom.xml (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/site-sd-top-parent-same-site/pom.xml Thu May 9 20:07:32 2013
@@ -46,4 +46,18 @@ under the License.
<modules>
<module>module1</module>
</modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <topSiteURL>file://@project.build.directory@/it/site-sd-top-parent-same-site/deploy/</topSiteURL>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractStagingMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractStagingMojo.java?rev=1480752&r1=1480751&r2=1480752&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractStagingMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractStagingMojo.java Thu May 9 20:07:32 2013
@@ -1,10 +1,5 @@
package org.apache.maven.plugins.site;
-import org.apache.maven.doxia.site.decoration.inheritance.URIPathDescriptor;
-import org.apache.maven.model.Site;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,6 +19,13 @@ import org.apache.maven.project.MavenPro
* under the License.
*/
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.doxia.site.decoration.inheritance.URIPathDescriptor;
+import org.apache.maven.model.Site;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+
/**
* Abstract base class for staging mojos.
*
@@ -34,6 +36,13 @@ public abstract class AbstractStagingMoj
extends AbstractDeployMojo
{
/**
+ * Top distribution management site url, for manual configuration when auto-calculated value
+ * doesn't match expectations. Relative module directory will be calculated from this url.
+ */
+ @Parameter( property = "topSiteURL" )
+ protected String topSiteURL;
+
+ /**
* The String "staging/".
*/
protected static final String DEFAULT_STAGING_DIRECTORY = "staging/";
@@ -46,13 +55,14 @@ public abstract class AbstractStagingMoj
/**
* By default, staging mojos will get their top distribution management site url by getting top parent
- * with the same site.
+ * with the same site, which is a good heuristics. But in case the default value doesn't match
+ * expectations, <code>topSiteURL</code> can be configured: it will be used instead.
*/
@Override
protected String determineTopDistributionManagementSiteUrl()
throws MojoExecutionException
{
- return getSite( getTopLevelProject( project ) ).getUrl();
+ return ( StringUtils.isEmpty( topSiteURL ) ) ? getSite( getTopLevelProject( project ) ).getUrl() : topSiteURL;
}
/**
Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=1480752&r1=1480751&r2=1480752&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java Thu May 9 20:07:32 2013
@@ -77,10 +77,19 @@ public class SiteStageDeployMojo
@Parameter( property = "stagingRepositoryId" )
private String stagingRepositoryId;
+ /**
+ * If <code>stagingSiteURL</code> is configured, top most parent with same staging site url
+ * will be used.
+ */
@Override
protected String determineTopDistributionManagementSiteUrl()
throws MojoExecutionException
{
+ if ( StringUtils.isNotEmpty( topSiteURL ) )
+ {
+ return topSiteURL;
+ }
+
if ( StringUtils.isNotEmpty( stagingSiteURL ) )
{
// We need to calculate the first project that supplied same stagingSiteURL