You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/01/22 14:03:40 UTC
svn commit: r371282 - in /myfaces/maven/trunk/wagon-maven-plugin: ./ src/
src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/myfaces/ src/main/java/org/apache/myfaces/wagon/
Author: bommel
Date: Sun Jan 22 05:03:23 2006
New Revision: 371282
URL: http://svn.apache.org/viewcvs?rev=371282&view=rev
Log:
added deploy wagon maven plugin
changed all assembly poms
you can used it with
mvn assembly:assembly org.apache.myfaces.maven:wagon-maven-plugin:deploy
Added:
myfaces/maven/trunk/wagon-maven-plugin/
myfaces/maven/trunk/wagon-maven-plugin/pom.xml
myfaces/maven/trunk/wagon-maven-plugin/src/
myfaces/maven/trunk/wagon-maven-plugin/src/main/
myfaces/maven/trunk/wagon-maven-plugin/src/main/java/
myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/
myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/
myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/
myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/wagon/
myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/wagon/WagonMojo.java
Added: myfaces/maven/trunk/wagon-maven-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/myfaces/maven/trunk/wagon-maven-plugin/pom.xml?rev=371282&view=auto
==============================================================================
--- myfaces/maven/trunk/wagon-maven-plugin/pom.xml (added)
+++ myfaces/maven/trunk/wagon-maven-plugin/pom.xml Sun Jan 22 05:03:23 2006
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.myfaces.maven</groupId>
+ <artifactId>wagon-maven-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <name>Wagon Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
Added: myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/wagon/WagonMojo.java
URL: http://svn.apache.org/viewcvs/myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/wagon/WagonMojo.java?rev=371282&view=auto
==============================================================================
--- myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/wagon/WagonMojo.java (added)
+++ myfaces/maven/trunk/wagon-maven-plugin/src/main/java/org/apache/myfaces/wagon/WagonMojo.java Sun Jan 22 05:03:23 2006
@@ -0,0 +1,157 @@
+package org.apache.myfaces.wagon;
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Site;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+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.authentication.AuthenticationException;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.repository.Repository;
+
+import java.io.File;
+
+
+/**
+ * Deploys the content of a directory using scp/file protocol.
+ * For scp protocol, 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. For file protocol, the files are copied
+ * directly to the destination directory.
+ *
+ * @version $Id: SiteDeployMojo.java 321326 2005-10-15 12:54:36Z brett $
+ * @goal deploy
+ */
+public class WagonMojo extends AbstractMojo
+{
+ /**
+ * Directory containing the files for wagon.
+ *
+ * @parameter
+ * @required
+ */
+ private File inputDirectory;
+
+ /**
+ * Specifies the server id.
+ *
+ * @parameter
+ * * @required
+ */
+ private String id;
+
+ /**
+ * The full URL of the server.
+ *
+ * @parameter
+ * @required
+ */
+ private String url;
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * @component
+ */
+ private WagonManager wagonManager;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( !inputDirectory.exists() )
+ {
+ throw new MojoExecutionException( "The inputDirectory does not exist" );
+ }
+
+ Repository repository = new Repository( id, url );
+
+
+ Wagon wagon = null;
+ try
+ {
+ wagon = wagonManager.getWagon( repository.getProtocol() );
+ }
+ catch ( UnsupportedProtocolException e )
+ {
+ throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );
+ }
+
+ if ( !wagon.supportsDirectoryCopy() )
+ {
+ throw new MojoExecutionException(
+ "Wagon protocol '" + repository.getProtocol() + "' doesn't support directory copying" );
+ }
+
+ try
+ {
+ Debug debug = new Debug();
+
+ wagon.addSessionListener( debug );
+
+ wagon.addTransferListener( debug );
+
+ wagon.connect( repository, wagonManager.getAuthenticationInfo( id ) );
+
+ wagon.putDirectory( inputDirectory, "." );
+
+ }
+ catch ( ResourceDoesNotExistException e )
+ {
+ throw new MojoExecutionException( "Error uploading", e );
+ }
+ catch ( TransferFailedException e )
+ {
+ throw new MojoExecutionException( "Error uploading", e );
+ }
+ catch ( AuthorizationException e )
+ {
+ throw new MojoExecutionException( "Error uploading", e );
+ }
+ catch ( ConnectionException e )
+ {
+ throw new MojoExecutionException( "Error uploading", e );
+ }
+ catch ( AuthenticationException e )
+ {
+ throw new MojoExecutionException( "Error uploading", e );
+ }
+ finally
+ {
+ try
+ {
+ wagon.disconnect();
+ }
+ catch ( ConnectionException e )
+ {
+ getLog().error( "Error disconnecting wagon - ignored", e );
+ }
+ }
+ }
+}