ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Russ Fink" <>
Subject newbie - if-then-else task?
Date Thu, 01 Jan 1970 00:00:00 GMT

I'm new at Ant and I will describe what I want to do -- followed with how I 
hope to do it.

I'm trying to copy files from two sources, a system directory followed by a 
local directory.  This is prior to a build, and I'm modifying an existing 
build file.  What I want is to copy a file from a system directory, and if a 
file exists in a similar local structure, I want to copy that version.  Both 
destinations are the same, i.e., a
generated directory.

I tried using the <copy> target to copy from the system location first, then 
the local directory second, and the problem is that the build fails if it 
doesn't find the file in the local directory.

How I want to do this is to use conditional logic.  Basically, if the local 
file exists, I want to use it, but if it doesn't exist, I want to use the 
system copy.

Questions.  Is this how you would do it?  If so, what is the method for 
<if-then-else> or what can I use?

I can't easily do this with <available>, since all that does is set a flag, 
which apparently can only be used in the <target> line.  What I want is 
within a target, being able to evaluate a tag and take some action.

I'm open to suggestions - Thanks,

PS: the manual is very good, but it would be much better if there were an 
index in it somewhat similar to Javadocs.

Get your FREE download of MSN Explorer at

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

View raw message