Author: brett
Date: Thu Apr  6 23:09:52 2006
New Revision: 392193

URL: http://svn.apache.org/viewcvs?rev=392193&view=rev
Log:
[MSITE-24] quick fix for making deployed website group writable

Modified:
    
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java

Modified: 
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteDeployMojo.java?rev=392193&r1=392192&r2=392193&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
 Thu Apr  6 23:09:52 2006
@@ -24,15 +24,17 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Settings;
+import org.apache.maven.wagon.CommandExecutionException;
+import org.apache.maven.wagon.CommandExecutor;
 import org.apache.maven.wagon.ConnectionException;
 import org.apache.maven.wagon.ResourceDoesNotExistException;
 import org.apache.maven.wagon.TransferFailedException;
 import org.apache.maven.wagon.UnsupportedProtocolException;
 import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.observers.Debug;
-import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.authentication.AuthenticationException;
 import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.observers.Debug;
+import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.repository.Repository;
 
 import java.io.File;
@@ -101,7 +103,7 @@
         if ( site == null )
         {
             throw new MojoExecutionException(
-                                              "Missing site information in the 
distribution management element in the project.." );
+                "Missing site information in the distribution management 
element in the project.." );
         }
 
         String url = site.getUrl();
@@ -117,7 +119,7 @@
 
         // TODO: work on moving this into the deployer like the other deploy 
methods
 
-        Wagon wagon = null;
+        Wagon wagon;
         try
         {
             wagon = wagonManager.getWagon( repository.getProtocol() );
@@ -129,8 +131,8 @@
 
         if ( !wagon.supportsDirectoryCopy() )
         {
-            throw new MojoExecutionException( "Wagon protocol '" + 
repository.getProtocol()
-                + "' doesn't support directory copying" );
+            throw new MojoExecutionException(
+                "Wagon protocol '" + repository.getProtocol() + "' doesn't 
support directory copying" );
         }
 
         try
@@ -152,6 +154,14 @@
             }
 
             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 )
+            {
+                CommandExecutor exec = (CommandExecutor) wagon;
+                exec.executeCommand( "chmod -R g+w " + repository.getBasedir() 
);
+            }
         }
         catch ( ResourceDoesNotExistException e )
         {
@@ -173,6 +183,10 @@
         {
             throw new MojoExecutionException( "Error uploading site", e );
         }
+        catch ( CommandExecutionException e )
+        {
+            throw new MojoExecutionException( "Error uploading site", e );
+        }
         finally
         {
             try
@@ -195,7 +209,7 @@
     public static ProxyInfo getProxyInfo( Settings settings )
     {
         ProxyInfo proxyInfo = null;
-        if ( ( settings != null ) && ( settings.getActiveProxy() != null ) )
+        if ( settings != null && settings.getActiveProxy() != null )
         {
             Proxy settingsProxy = settings.getActiveProxy();
 


Reply via email to