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 2009/07/29 16:21:10 UTC

svn commit: r798916 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: SiteDeployMojo.java SiteStageDeployMojo.java

Author: ltheussl
Date: Wed Jul 29 14:21:09 2009
New Revision: 798916

URL: http://svn.apache.org/viewvc?rev=798916&view=rev
Log:
[MSITE-30, MSITE-141, MSITE-339, MSITE-380] Make chmod command after deploy optional and configurable.

Modified:
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.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/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=798916&r1=798915&r2=798916&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java Wed Jul 29 14:21:09 2009
@@ -85,6 +85,33 @@
     private File inputDirectory;
 
     /**
+     * Whether to run the "chmod" command on the remote site after the deploy.
+     * Defaults to "true".
+     *
+     * @parameter expression="${maven.site.chmod}" default-value="true"
+     * @since 2.1
+     */
+    private boolean chmod;
+
+    /**
+     * The mode used by the "chmod" command. Only used if chmod = true.
+     * Defaults to "g+w,a+rX".
+     *
+     * @parameter expression="${maven.site.chmod.mode}" default-value="g+w,a+rX"
+     * @since 2.1
+     */
+    private String chmodMode;
+
+    /**
+     * The options used by the "chmod" command. Only used if chmod = true.
+     * Defaults to "-Rf".
+     *
+     * @parameter expression="${maven.site.chmod.options}" default-value="-Rf"
+     * @since 2.1
+     */
+    private String chmodOptions;
+
+    /**
      * @parameter expression="${project}"
      * @required
      * @readonly
@@ -107,6 +134,7 @@
 
     private PlexusContainer container;
 
+    /** {@inheritDoc} */
     public void execute()
         throws MojoExecutionException
     {
@@ -186,12 +214,10 @@
 
             wagon.putDirectory( inputDirectory, "." );
 
-            // TODO: current wagon uses zip which will use the umask on remote host instead of honouring our settings
-            //  Force group writeable
-            if ( wagon instanceof CommandExecutor )
+            if ( chmod && wagon instanceof CommandExecutor )
             {
                 CommandExecutor exec = (CommandExecutor) wagon;
-                exec.executeCommand( "chmod -Rf g+w,a+rX " + repository.getBasedir() );
+                exec.executeCommand( "chmod " + chmodOptions + " " + chmodMode + " " + repository.getBasedir() );
             }
         }
         catch ( ResourceDoesNotExistException e )

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=798916&r1=798915&r2=798916&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 Wed Jul 29 14:21:09 2009
@@ -77,13 +77,40 @@
      * The identifier of the repository where the staging site will be deployed. This id will be used to lookup a
      * corresponding <code>&lt;server&gt;</code> entry from the <code>settings.xml</code>. If a matching
      * <code>&lt;server&gt;</code> entry is found, its configured credentials will be used for authentication.
-     * 
+     *
      * @parameter expression="${stagingRepositoryId}" default-value="stagingSite"
      * @since 2.0.1
      */
     private String stagingRepositoryId;
 
     /**
+     * Whether to run the "chmod" command on the remote site after the deploy.
+     * Defaults to "true".
+     *
+     * @parameter expression="${maven.site.chmod}" default-value="true"
+     * @since 2.1
+     */
+    private boolean chmod;
+
+    /**
+     * The mode used by the "chmod" command. Only used if chmod = true.
+     * Defaults to "g+w,a+rX".
+     *
+     * @parameter expression="${maven.site.chmod.mode}" default-value="g+w,a+rX"
+     * @since 2.1
+     */
+    private String chmodMode;
+
+    /**
+     * The options used by the "chmod" command. Only used if chmod = true.
+     * Defaults to "-Rf".
+     *
+     * @parameter expression="${maven.site.chmod.options}" default-value="-Rf"
+     * @since 2.1
+     */
+    private String chmodOptions;
+
+    /**
      * @component
      */
     private WagonManager wagonManager;
@@ -100,7 +127,7 @@
     private PlexusContainer container;
 
     /**
-     * @see org.apache.maven.plugin.Mojo#execute()
+     * {@inheritDoc}
      */
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -167,12 +194,10 @@
 
             wagon.putDirectory( new File( stagingDirectory, getStructure( project, false ) ), "." );
 
-            // TODO: current wagon uses zip which will use the umask on remote host instead of honouring our settings
-            //  Force group writeable
-            if ( wagon instanceof CommandExecutor )
+            if ( chmod && wagon instanceof CommandExecutor )
             {
                 CommandExecutor exec = (CommandExecutor) wagon;
-                exec.executeCommand( "chmod -Rf g+w,a+rX " + repository.getBasedir() );
+                exec.executeCommand( "chmod " + chmodOptions + " " + chmodMode + " " + repository.getBasedir() );
             }
         }
         catch ( ResourceDoesNotExistException e )