You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2009/08/24 00:42:13 UTC

svn commit: r807026 - in /maven/plugins/branches/maven-site-plugin-3.x/src: it/MSITE-304/ main/java/org/apache/maven/plugins/site/

Author: olamy
Date: Sun Aug 23 22:42:12 2009
New Revision: 807026

URL: http://svn.apache.org/viewvc?rev=807026&view=rev
Log:
fix wagon connection

Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh   (with props)
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/goals.txt
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.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

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/goals.txt?rev=807026&r1=807025&r2=807026&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/goals.txt (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/goals.txt Sun Aug 23 22:42:12 2009
@@ -1 +1 @@
-site:stage-deploy
\ No newline at end of file
+clean site:stage-deploy
\ No newline at end of file

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh?rev=807026&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh Sun Aug 23 22:42:12 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+try
+{
+	String tmpDir = System.getProperty( "java.io.tmpdir" );
+	File dirToClean = new File(tmpDir, "www.example.com" );
+	FileUtils.deleteDirectory( dirToClean );
+}
+catch( IOException e )
+{
+    e.printStackTrace();
+    result = false;
+}
+return result;
\ No newline at end of file

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/prebuild.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=807026&r1=807025&r2=807026&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Sun Aug 23 22:42:12 2009
@@ -67,6 +67,7 @@
 import org.codehaus.plexus.context.Context;
 import org.codehaus.plexus.context.ContextException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 /**

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=807026&r1=807025&r2=807026&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 Sun Aug 23 22:42:12 2009
@@ -341,6 +341,7 @@
                                 Log log )
         throws WagonConfigurationException
     {
+        log.debug( " configureWagon " );
         // MSITE-25: Make sure that the server settings are inserted
         for ( int i = 0; i < settings.getServers().size(); i++ )
         {
@@ -356,6 +357,7 @@
                     ComponentConfigurator componentConfigurator = null;
                     try
                     {
+                        // FIXME role-hint basic ?
                         componentConfigurator = (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE );
                         componentConfigurator.configureComponent( wagon, plexusConf, container.getContainerRealm() );
                     }

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=807026&r1=807025&r2=807026&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 Sun Aug 23 22:42:12 2009
@@ -35,13 +35,11 @@
 import org.apache.maven.wagon.TransferFailedException;
 import org.apache.maven.wagon.UnsupportedProtocolException;
 import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.authentication.AuthenticationException;
 import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.events.SessionEvent;
 import org.apache.maven.wagon.observers.Debug;
 import org.apache.maven.wagon.repository.Repository;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 
 /**
@@ -154,6 +152,7 @@
         {
             wagon = wagonManager.getWagon( repository );
             SiteDeployMojo.configureWagon( wagon, stagingRepositoryId, settings, plexusContainer, getLog() );
+            wagon.connect( repository );
         }
         catch ( UnsupportedProtocolException e )
         {
@@ -162,6 +161,13 @@
         catch ( WagonConfigurationException e )
         {
             throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );
+        } catch (AuthenticationException e)
+        {
+            throw new MojoExecutionException( "AuthenticationException : Unable to connect Wagon to repository : '" + repository.getProtocol() + "'", e );
+        }
+        catch ( ConnectionException e )
+        {
+            throw new MojoExecutionException( "Unable to connect Wagon to repository : '" + repository.getProtocol() + "'", e );
         }
 
         if ( !wagon.supportsDirectoryCopy() )
@@ -170,9 +176,26 @@
                 "Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying" );
         }
 
+        getLog().debug( "wagon == null " + ( wagon == null ) );
+        getLog().debug( "wagon class " + wagon.getClass() );
+        
         try
         {
-            Debug debug = new Debug();
+            Debug debug = new Debug(){
+                public void sessionDisconnecting( final SessionEvent sessionEvent )
+                {
+                    getLog().debug( "sessionDisconnecting" );
+                    getLog().debug( " sessionEvent.getWagon() == null " + (sessionEvent.getWagon() == null) );
+                    getLog().debug( " sessionEvent.getWagon().getRepository() == null " + (sessionEvent.getWagon().getRepository() == null) );
+                    //getLog().info( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Disconnecting  " );
+
+                }    
+                public void sessionDisconnected( final SessionEvent sessionEvent )
+                {
+                    getLog().debug( "sessionDisconnected" );
+                }                
+            };
+            
 
             wagon.addSessionListener( debug );
 
@@ -192,6 +215,7 @@
             */
             wagon.putDirectory( new File( stagingDirectory, getStructure( project, false ) ), "." );
 
+            getLog().debug( "putDirectory end ok " );
             if ( chmod && wagon instanceof CommandExecutor )
             {
                 CommandExecutor exec = (CommandExecutor) wagon;