maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources ResourcesMojo.java
Date Tue, 22 Mar 2005 13:33:29 GMT
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 );
           }
       }
   
  
  
  

Mime
View raw message