ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Weighill-Smith" <>
Subject RE: Bug in the "glob" file mapper?
Date Fri, 13 Aug 2004 21:16:22 GMT
(Sorry if this message is HTML: having to use Outlook Web Access and don't know how to control
the mail format!)
Thanks for the info. Note that the documentation for the file mappers states that "to" and
"from" can "contain at most one '*'", which implies to me that they can legitimately have
zero stars. In this particular case the fileset defined selects just one file, ant.jar, which
is what I want to copy to a different directory. The problem is that I don't know (in the
Ant script) the exact path to the ant.jar so I'm using "**/ant.jar":
<copy todir="${dest}">
    <fileset dir="${source}" includes="**/ant.jar"/>
    <mapper type="glob" from="*/ant.jar" to="internal/ant.jar"/>
What I want to do is copy the one and only "${source}/.../ant.jar" to "${dest}/internal/ant.jar".
Because the Ant script is itself generated (generically) such that the copy "todir" attribute
is fixed as "${dest}" I can't simply set that to "${dest}/internal" and use a flatten mapper
which is what I'd otherwise do.
If you can think of a way of doing this processing with just changing the body content of
the copy element and not the copy element itself I'd love to know the solution! Perhaps the
regexp mapper would do this?
Phil :n(

	-----Original Message----- 
	From: Dominique Devienne [] 
	Sent: Fri 13/08/2004 19:07 
	To: Ant Developers List 
	Subject: RE: Bug in the "glob" file mapper?

	> From: Phil Weighill-Smith []
	> The "glob" file mapper is exhibiting a behaviour I didn't expect:
	> <copy ...
	>     <fileset ...
	>     <mapper type="glob" from="*/ant.jar" to="internal/ant.jar"/>
	> </copy>
	> Assuming that "*" matches "env/apache-ant-1.6.2/lib" I expected this
	> copy the ant.jar to a destination of copy's todir + /internal/ant.jar.
	> What it actually does is copy it to copy's todir +
	> /internal/ant.jarenv/apache-ant-1.6.2/lib.
	> I.e. if you don't use a "*" in the to attribute of the mapper, the "*"
	> match is suffixed onto the "to". This seems wrong to me. Is this a
	It's wrong in the sense that the glob mapper should most likely throw an
	error when the "*" is missing in the 'to' attribute.
	You can't use the glob mapper to concatenate files like this, and even
	if it worked, plain concatenation wouldn't work with .jar files.
	Use <concat> for plain concatenation.
	Use <jar> or <zip> with <zipfileset> for concatenation of JAR/ZIP files.
	To unsubscribe, e-mail:
	For additional commands, e-mail:

View raw message