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/04/04 14:19:40 UTC
svn commit: r1088586 - in
/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site:
AbstractDeployMojo.java SiteStageDeployMojo.java
Author: ltheussl
Date: Mon Apr 4 12:19:40 2011
New Revision: 1088586
URL: http://svn.apache.org/viewvc?rev=1088586&view=rev
Log:
[MSITE-573] make default stagingRepositoryId match site id. Merged r1088584 from trunk.
Modified:
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
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=1088586&r1=1088585&r2=1088586&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 Mon Apr 4 12:19:40 2011
@@ -715,7 +715,7 @@ public abstract class AbstractDeployMojo
*
* @throws MojoExecutionException if any of the site info is missing.
*/
- private static Site getSite( final MavenProject project )
+ protected static Site getSite( final MavenProject project )
throws MojoExecutionException
{
final String name = project.getName() + " ("
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=1088586&r1=1088585&r2=1088586&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 Mon Apr 4 12:19:40 2011
@@ -59,7 +59,13 @@ public class SiteStageDeployMojo
* corresponding <code><server></code> entry from the <code>settings.xml</code>. If a matching
* <code><server></code> entry is found, its configured credentials will be used for authentication.
*
- * @parameter expression="${stagingRepositoryId}" default-value="stagingSite"
+ * If this is not specified, then the corresponding value of <code>distributionManagement.site.id</code>
+ * will be taken as default, unless this is not defined either then the String
+ * <code>"stagingSite"</code> is used. (<strong>Note</strong>:
+ * until v. 2.3 and 3.0-beta-3 the String <code>"stagingSite"</code> is always used.)
+ *
+ * @parameter expression="${stagingRepositoryId}"
+ *
* @since 2.0.1
*/
private String stagingRepositoryId;
@@ -68,6 +74,10 @@ public class SiteStageDeployMojo
protected String getDeployRepositoryID()
throws MojoExecutionException
{
+ stagingRepositoryId = stagingRepoId ( stagingRepositoryId );
+
+ getLog().info( "Using this server ID for stage deploy: " + stagingRepositoryId );
+
return stagingRepositoryId;
}
@@ -75,7 +85,7 @@ public class SiteStageDeployMojo
protected String getDeployRepositoryURL()
throws MojoExecutionException
{
- stagingSiteURL = getStagingSiteURL( stagingSiteURL );
+ stagingSiteURL = stagingSiteURL( stagingSiteURL );
getLog().info( "Using this base URL for stage deploy: " + stagingSiteURL );
@@ -89,7 +99,7 @@ public class SiteStageDeployMojo
*
* @return the site URL for staging
*/
- private String getStagingSiteURL( String usersStagingSiteURL )
+ private String stagingSiteURL( final String usersStagingSiteURL )
throws MojoExecutionException
{
String topLevelURL = null;
@@ -114,4 +124,21 @@ public class SiteStageDeployMojo
// topLevelProjectURL + "staging"
return topLevelURL;
}
+
+ private String stagingRepoId( final String stagingRepoId )
+ {
+ if ( stagingRepoId != null )
+ {
+ return stagingRepoId;
+ }
+
+ try
+ {
+ return getSite( project ).getId();
+ }
+ catch ( MojoExecutionException ex )
+ {
+ return "stagingSite";
+ }
+ }
}