mirror of https://github.com/apache/maven.git
convert resources mojo to new execute().
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163661 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
964aa52888
commit
d0de5773b3
maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources
|
@ -19,8 +19,7 @@ package org.apache.maven.plugin.resources;
|
||||||
|
|
||||||
import org.apache.maven.model.Resource;
|
import org.apache.maven.model.Resource;
|
||||||
import org.apache.maven.plugin.AbstractPlugin;
|
import org.apache.maven.plugin.AbstractPlugin;
|
||||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
import org.apache.maven.plugin.PluginExecutionException;
|
||||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -54,33 +53,33 @@ import java.util.List;
|
||||||
public class ResourcesMojo
|
public class ResourcesMojo
|
||||||
extends AbstractPlugin
|
extends AbstractPlugin
|
||||||
{
|
{
|
||||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
private String outputDirectory;
|
||||||
throws Exception
|
|
||||||
|
private List resources;
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
throws PluginExecutionException
|
||||||
{
|
{
|
||||||
// ----------------------------------------------------------------------
|
try
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
String outputDirectory = (String) request.getParameter( "outputDirectory" );
|
|
||||||
|
|
||||||
List resources = (List) request.getParameter( "resources" );
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); )
|
|
||||||
{
|
{
|
||||||
ResourceEntry resourceEntry = (ResourceEntry) i.next();
|
for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); )
|
||||||
|
|
||||||
File destinationFile = new File( outputDirectory, resourceEntry.getDestination() );
|
|
||||||
|
|
||||||
if ( !destinationFile.getParentFile().exists() )
|
|
||||||
{
|
{
|
||||||
destinationFile.getParentFile().mkdirs();
|
ResourceEntry resourceEntry = (ResourceEntry) i.next();
|
||||||
}
|
|
||||||
|
|
||||||
fileCopy( resourceEntry.getSource(), destinationFile.getPath() );
|
File destinationFile = new File( outputDirectory, resourceEntry.getDestination() );
|
||||||
|
|
||||||
|
if ( !destinationFile.getParentFile().exists() )
|
||||||
|
{
|
||||||
|
destinationFile.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
fileCopy( resourceEntry.getSource(), destinationFile.getPath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
// TODO: handle exception
|
||||||
|
throw new PluginExecutionException( "Error copying resources", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue