You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sunil Ravipati <su...@oracle.com> on 2004/04/08 20:25:27 UTC

Using replace

How do I use replace to replace a value or set a value of properties in a property file .

Thanks,
Sunil


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


Re: Using replace

Posted by Sunil Ravipati <su...@oracle.com>.
Thanks bill. I read the manuaI. I wanted to use replace in a .txt file which is has name value pairs like

myproject.property1
myproject.property2 = false

I want to set myproject.property1 = true based on a condition in the build process. I can do a

<repalce file="" token ="" value="">

but can I do set a value to ${myproject.property1 }

Thanks,
Sunil


Bill Rich wrote:

> In the manual is a description of Replace that says
> "Replace is a directory based task for replacing the occurrence of a given string with
> another string in selected file.
>
> If you want to replace a text that crosses line boundaries, you must use a nested
> <replacetoken> element.
>
> The output file is only written if it differs from the existing file. This prevents
> spurious rebuilds based on unchanged files which have been regenerated by this task."
>
> So if this is what you want to do you simply code the appropriate set of attributes (also
> described in the manual) and replace will do what it is supposed to do.  There are also
> some examples in the manual.  It is not difficult to figure out if you read the manual and
> work with the examples.
>
> If this is not what you want to do then you need to provide a better description of your
> specific requirements after reading the manual to see if there is anything that may do
> what you want to do.
>
> I have been using Ant for about 2 months and _all_ my questions have been answered by
> reading the manual and trying it out.
> Thanks.  Bill
>
> Bill Rich
> Wilandra Consulting LLC
> 1325 Addiewell Place
> San Jose, CA  95120-3905
> phone:      +1 408 268-2452
> mobile:     +1 408 410-9713
> Santa Cruz: +1 831 464-9007
> fax:        +1 413 669-9716
> billrich@wilandra.com or billrich@attglobal.net
> http://www.wilandra.com
>
> -----Original Message-----
> From: Sunil Ravipati [mailto:sunil.ravipati@oracle.com]
> Sent: Thursday, April 08, 2004 11:25 AM
> To: user@ant.apache.org
> Subject: Using replace
>
> How do I use replace to replace a value or set a value of properties in a property file .
>
> Thanks,
> Sunil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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


RE: Using replace

Posted by Bill Rich <bi...@attglobal.net>.
In the manual is a description of Replace that says
"Replace is a directory based task for replacing the occurrence of a given string with
another string in selected file.

If you want to replace a text that crosses line boundaries, you must use a nested
<replacetoken> element.

The output file is only written if it differs from the existing file. This prevents
spurious rebuilds based on unchanged files which have been regenerated by this task."

So if this is what you want to do you simply code the appropriate set of attributes (also
described in the manual) and replace will do what it is supposed to do.  There are also
some examples in the manual.  It is not difficult to figure out if you read the manual and
work with the examples.

If this is not what you want to do then you need to provide a better description of your
specific requirements after reading the manual to see if there is anything that may do
what you want to do.

I have been using Ant for about 2 months and _all_ my questions have been answered by
reading the manual and trying it out.
Thanks.  Bill

Bill Rich
Wilandra Consulting LLC
1325 Addiewell Place
San Jose, CA  95120-3905
phone:      +1 408 268-2452
mobile:     +1 408 410-9713
Santa Cruz: +1 831 464-9007
fax:        +1 413 669-9716
billrich@wilandra.com or billrich@attglobal.net
http://www.wilandra.com

-----Original Message-----
From: Sunil Ravipati [mailto:sunil.ravipati@oracle.com]
Sent: Thursday, April 08, 2004 11:25 AM
To: user@ant.apache.org
Subject: Using replace


How do I use replace to replace a value or set a value of properties in a property file .

Thanks,
Sunil


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



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