ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Faustinelli <>
Subject FileNameMapper implementation gets invoked twice inside a <chainedmapper>
Date Mon, 03 May 2010 12:43:15 GMT
Good day to everybody,

I have written a FileNameMapper that gets invoked during the run of a <copy> task. What
puzzles me is that the mapper is invoked TWICE per each file handled by the copy task, whereas
I request only ONE invocation.

The details follow here. Thanks in advance to whoever will want to spend some time on my issue.

Have a nice day,
Marco Faustinelli - Italy

The mapper writes the name of the file currently processed into a property of my chosing.
The signature of the class is:

publicclassFilenameInPropertySettingMapper extendsProjectComponent implementsFileNameMapper
The mapFileName(String sourceFileName) method is just like the IdentityMapper, plus the
instruction getProject().setProperty(property, sourceFileName) along it. I have also added
a log call to monitor the activity of the mapper.
My build.xml looks contains the following <typedef>:
Inside the target I have the lines:
<copy todir=".....">
 <fileset ... />
   <filenameSetMapper property="currentFile" />
   <globmapper from="*.csv" to="*.xml" casesensitive="no" />
 <filterchain ... />

When I run the script I verify that the property currentFile is set correctly and I can use
it in the remainder of the <copy>. But I can see from the log that my mapper is invoked
TWICE for each file found in the fileset.
Can anybody explain me what is happening? How can I avoid this potentially dangerous double
Thanks in advance
Marco Faustinelli, Italy
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message