Author: brett
Date: Sun Aug 28 00:18:35 2005
New Revision: 263841
URL: http://svn.apache.org/viewcvs?rev=263841&view=rev
Log:
PR: MNG-788
bring back the "filtering" attribute in resources from m1
Modified:
maven/components/trunk/maven-model/maven.mdo
maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
Modified: maven/components/trunk/maven-model/maven.mdo
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=263841&r1=263840&r2=263841&view=diff
==============================================================================
--- maven/components/trunk/maven-model/maven.mdo (original)
+++ maven/components/trunk/maven-model/maven.mdo Sun Aug 28 00:18:35 2005
@@ -1935,7 +1935,7 @@
</field>
<field>
<name>filtering</name>
- <version>3.0.0</version>
+ <version>3.0.0+</version>
<description><![CDATA[Boolean. Describe if resources are filtered or
not.]]></description>
<type>boolean</type>
<defaultValue>false</defaultValue>
Modified:
maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java?rev=263841&r1=263840&r2=263841&view=diff
==============================================================================
---
maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
(original)
+++
maven/components/trunk/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
Sun Aug 28 00:18:35 2005
@@ -97,40 +97,14 @@
public void execute()
throws MojoExecutionException
{
- initializeFiltering();
copyResources( resources, outputDirectory );
}
protected void copyResources( List resources, String outputDirectory )
throws MojoExecutionException
{
- try
- {
- for ( Iterator i = getJarResources( resources
).entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- File source = (File) entry.getKey();
- String destination = (String) entry.getValue();
-
- File destinationFile = new File( outputDirectory, destination
);
-
- if ( !destinationFile.getParentFile().exists() )
- {
- destinationFile.getParentFile().mkdirs();
- }
-
- copyFile( source, destinationFile );
- }
- }
- catch ( Exception e )
- {
- // TODO: handle exception
- throw new MojoExecutionException( "Error copying resources", e );
- }
- }
+ initializeFiltering();
- private Map getJarResources( List resources )
- {
Map resourceEntries = new TreeMap();
for ( Iterator i = resources.iterator(); i.hasNext(); )
@@ -170,18 +144,32 @@
{
String name = (String) j.next();
- String entryName = name;
+ String destination = name;
if ( targetPath != null )
{
- entryName = targetPath + "/" + name;
+ destination = targetPath + "/" + name;
}
- resourceEntries.put( new File( resource.getDirectory(), name
), entryName );
+ File source = new File( resource.getDirectory(), name );
+
+ File destinationFile = new File( outputDirectory, destination
);
+
+ if ( !destinationFile.getParentFile().exists() )
+ {
+ destinationFile.getParentFile().mkdirs();
+ }
+
+ try
+ {
+ copyFile( source, destinationFile, resource.isFiltering()
&& filtering );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error copying
resources", e );
+ }
}
}
-
- return resourceEntries;
}
private void initializeFiltering()
@@ -200,7 +188,7 @@
}
}
- private void copyFile( File from, File to )
+ private void copyFile( File from, File to, boolean filtering )
throws IOException
{
if ( !filtering )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]