ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Search and replace in property
Date Tue, 27 Nov 2007 18:00:18 GMT
Are you actually doing something with the properties before doing the
replace? If not, you could use a filter. Unfortunately, <property> doesn't
support the filter directly, but you could copy the property file, then use
the <property file="xxx"/> to point to your copy:

<copy file="orig.properties"
   tofile="new.properties">
   <filterset>
        <filter token="sometoken" value="somevalue"/>
   <filterset>
 </copy>
 <properties file="new.properties"/>

Remember that you cannot change a property once it is set! If you do need to
change properties look at the AntContrib <variable> task.

On Nov 27, 2007 7:54 AM, Ognjen Blagojevic <ognjen@etf.bg.ac.yu> wrote:

> Hi all,
>
> I need tho read the properties from the file, and then to do a string
> replacement in their values.
>
> Something like this:
>
> 1. read_properties
> 2. do_something_with_properties
> 3. replace_in_property('&', '&amp;')
> 4. do_someting_else_with_escaped_properties
>
> How can I do the step 3?
>
>
> The only solution I came up with is to use ReplaceRegExp task, and write
> escaped properties to another file, and then, reread them. Is there
> anything smarter than that? Something that avoids creation of another
> file?
>
> Regards,
> Ognjen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
--
David Weintraub
qazwart@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message