Return-Path: Delivered-To: apmail-maven-m2-dev-archive@www.apache.org Received: (qmail 72675 invoked from network); 22 Mar 2005 13:33:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Mar 2005 13:33:31 -0000 Received: (qmail 41993 invoked by uid 500); 22 Mar 2005 13:33:31 -0000 Delivered-To: apmail-maven-m2-dev-archive@maven.apache.org Received: (qmail 41976 invoked by uid 500); 22 Mar 2005 13:33:30 -0000 Mailing-List: contact m2-dev-help@maven.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Maven 2 Developers List" Reply-To: "Maven 2 Developers List" Delivered-To: mailing list m2-dev@maven.apache.org Received: (qmail 41963 invoked by uid 500); 22 Mar 2005 13:33:30 -0000 Delivered-To: apmail-maven-components-cvs@apache.org Received: (qmail 41960 invoked by uid 99); 22 Mar 2005 13:33:30 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 22 Mar 2005 05:33:30 -0800 Received: (qmail 72650 invoked by uid 1717); 22 Mar 2005 13:33:29 -0000 Date: 22 Mar 2005 13:33:29 -0000 Message-ID: <20050322133329.72649.qmail@minotaur.apache.org> From: brett@apache.org To: maven-components-cvs@apache.org Subject: cvs commit: maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources ResourcesMojo.java X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N brett 2005/03/22 05:33:29 Modified: maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources ResourcesMojo.java Log: convert resources mojo to new execute(). Revision Changes Path 1.13 +23 -24 maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java Index: ResourcesMojo.java =================================================================== RCS file: /home/cvs/maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ResourcesMojo.java 10 Mar 2005 01:35:13 -0000 1.12 +++ ResourcesMojo.java 22 Mar 2005 13:33:29 -0000 1.13 @@ -19,8 +19,7 @@ import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractPlugin; -import org.apache.maven.plugin.PluginExecutionRequest; -import org.apache.maven.plugin.PluginExecutionResponse; +import org.apache.maven.plugin.PluginExecutionException; import org.codehaus.plexus.util.FileUtils; import java.io.ByteArrayOutputStream; @@ -54,33 +53,33 @@ public class ResourcesMojo extends AbstractPlugin { - public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) - throws Exception - { - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- - - String outputDirectory = (String) request.getParameter( "outputDirectory" ); - - List resources = (List) request.getParameter( "resources" ); + private String outputDirectory; - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- + private List resources; - for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); ) + public void execute() + throws PluginExecutionException + { + try { - ResourceEntry resourceEntry = (ResourceEntry) i.next(); + for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); ) + { + ResourceEntry resourceEntry = (ResourceEntry) i.next(); - File destinationFile = new File( outputDirectory, resourceEntry.getDestination() ); + File destinationFile = new File( outputDirectory, resourceEntry.getDestination() ); - if ( !destinationFile.getParentFile().exists() ) - { - destinationFile.getParentFile().mkdirs(); - } + if ( !destinationFile.getParentFile().exists() ) + { + destinationFile.getParentFile().mkdirs(); + } - fileCopy( resourceEntry.getSource(), destinationFile.getPath() ); + fileCopy( resourceEntry.getSource(), destinationFile.getPath() ); + } + } + catch ( Exception e ) + { + // TODO: handle exception + throw new PluginExecutionException( "Error copying resources", e ); } }