You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/09/29 03:18:14 UTC
svn commit: r292366 -
/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java
Author: brett
Date: Wed Sep 28 18:18:09 2005
New Revision: 292366
URL: http://svn.apache.org/viewcvs?rev=292366&view=rev
Log:
PR: MNG-484
Submitted by: Binyan
Reviewed by: Brett Porter
add file:// deployment mechanism to site:deploy
Modified:
maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java
Modified: maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java?rev=292366&r1=292365&r2=292366&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/ScpSiteDeployMojo.java Wed Sep 28 18:18:09 2005
@@ -37,11 +37,12 @@
import java.util.zip.ZipOutputStream;
/**
- * Deploys website using scp protocol.
- * First website files are packaged into zip archive,
+ * Deploys website using scp/file protocol.
+ * For scp protocol, website files are packaged into zip archive,
* then archive is transfred to remote host, nextly it is un-archived.
* This method of deployment should normally be much faster
- * then making file by file copy.
+ * then making file by file copy. For file protocol, the files are copied
+ * directly to the destination directory.
*
* @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
* @version $Id$
@@ -120,12 +121,51 @@
Repository repository = new Repository( id, url );
- if ( !"scp".equals( repository.getProtocol() ) )
+ String siteProtocol = repository.getProtocol();
+
+ if ( "scp".equals( siteProtocol ) )
+ {
+ scpDeploy( zipFile, id, repository );
+ }
+ else if ( "file".equals( siteProtocol ) )
+ {
+ File toDir = new File( repository.getBasedir() );
+ fileDeploy( toDir );
+ }
+ else
{
throw new MojoExecutionException(
- "The deploy mojo currently only supports site deployment using the 'scp' protocol." );
+ "The deploy mojo currently only supports site deployment using the 'scp' and 'file' protocols." );
+ }
+ }
+
+
+ /**
+ * @throws MojoExecutionException
+ */
+ private void fileDeploy( File toDir )
+ throws MojoExecutionException
+ {
+ try
+ {
+ FileUtils.copyDirectoryStructure( inputDirectory, toDir );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error transfering site!", e );
}
+ }
+
+ /**
+ * @param zipFile
+ * @param id
+ * @param repository
+ * @throws MojoExecutionException
+ */
+ private void scpDeploy( File zipFile, String id, Repository repository )
+ throws MojoExecutionException
+ {
SshCommandExecutor commandExecutor = null;
try
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org