ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <>
Subject Re: AW: [Maybe spam] Re: using file names
Date Wed, 13 Apr 2005 11:53:38 GMT
Hello, I am not sure if this will do your job, but
here is a working snippet.
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<for param="file">
    <fileset dir="${basedir}" includes="*.xml"/>
    <basename file="@{file}"
    <echo>basename is ${@{file}.basename}</echo>

Here we bump in the following issue: ant properties
are immutable so if we use basename in the following
<basename file="@{file}" property="basename"/>
the first iteration of <for> will set a property named
 "basename" and all other resets of this property in
the next iteration will have no effect. That is why we
append the absolute name of the file to the name of
the  property to ensure uniqueness of the proeprties'

However, I do not like this solution, because <for> is
not "the Ant way of doing things" so think twice
before using it. Could you provide more information
what are you trying to achieve with <for> and
<uptodate>; a better idea might come up.

HTH Ivan

--- Huditsch Roman <>
> Ah, I see.
> But how can I incorporate it into an <uptodate>
> statement?
> <uptodate property="copy.notRequired"
> srcfile="@{file}">
> 	<!-- How to specify my @targetfile correctly? -->
> </uptodate>
> I would like to test @{file} againt the same
> basename within the "result" directory....
> I tried it first with "result/@{file}" which gave me
> "result/c:\Programme\test.xml".
> I also tried 
> <uptodate property="copy.notRequired"
> srcfile="@{file}">
> 	<mapper>
> 		<flattenmapper/>
> 		<globmapper from="*" to="result/*"/>
> 	</mapper>
> </uptodate>
> but with no success either....
> Thanks for the help!
> wbr,
> Roman

Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message