ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Gordon" <tim.gor...@allustra.com>
Subject Expanding properties
Date Fri, 27 Jan 2006 11:29:15 GMT
Hi

Say I have a file, called contents.txt, which contains the text:

contents.txt:
The value is ${something}

And I have a property file values.properties which reads

values.propeties:
something=somevalue

How to I turn contents.txt into

contents.txt:
The value is somevalue

I can do this with

    <property file="values.properties"/>
    <replace file="contents.txt">
      <replacefilter token="${something}" value="${something}"/>
    </replace>

But this would be painstaking if I had lots of properties to replace - I'd
have to define each property and then add a <replacefilter> for each one.

I had hoped that this would work:

    <property file="values.properties"/>
    <loadfile property="temp.property" srcfile="contents.txt"/>
    <echo message="${temp.property}"/>

But it doesn't - what I'm really after is a way to re-use the in-file
property expansion performed by <property>. Is there a way to do this?

Tim

Allustra Limited
85 Gracechurch Street
London
EC3V 0AA
Tel +44 (0)20 7469 8640
Fax +44 (0)20 7469 8689
http://www.allustra.com/





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message