ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Skeet" <>
Subject Replace task - getting *tokens* from a properties file?
Date Wed, 13 Jun 2001 14:36:36 GMT
[Apologies for posting to both lists - I'm really not sure which this
mail belongs to. As I may have future similar ones, guidance on where to
post such mails in future is warmly welcome. I'm monitoring both lists,
so feel free to trim replies.]

I'm trying to convert our company's build procedure to Ant. I'm doing
pretty well (with the addition of a couple of tasks - CopyProperty which
sets the value of one specified property to the value of another; I
think it's the only way of doing effectively ${${embedded}.property},
and works well enough for now, and FailUnless which simply fails unless
a given property is set - I need this because "if" doesn't resolve
property values (ie doing if="${project}" doesn't resolve project and
then test whether or not that name has is set), but I've run up against
something slightly trickier.

In my old build procedure I had a few steps which take a normal file
(.java or whatever) and a properties file. The properties file had, for


I have a little Java program which looks through the properties file,
finds all the properties within it, then does a replace on all the
"normal" files using these properties wrapped in <%...%>. In this case,
it would be the equivalent of:

<replace {insert src files here}>
  <replacefilter token="<%Version%>" value="foo"/>
  <replacefilter token="<%Name%>" value="bar"/>

However, I'd like the property files to determine the tokens, as my
previous build did.

I can probably hack something up in Replace, something like:

<multiplereplacefilter file="" prefix="<%" postfix="%>" />

but I'm not sure that such a patch would get accepted. (Speaking of
which, has anyone glanced at my Zip and VSS patches yet?)

It feels slightly silly to create a whole new task for something so
similar to Replace.
Ideas welcome.


View raw message