Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / November 2003

Tip: Looking for answers? Try searching our database.

Ant: How to escape property substitution?

Thread view: 
Ronald Fischer - 26 Nov 2003 14:04 GMT
If a property foo is defined, the string

  ${foo}

is replaced by the value of foo inside an ant
build script.

How can I pass the string literally, without
substitution, to an ant task? Example:
I want to replace all occurences of the string

  ${abc}

by

  ${xyz}

in a file. Using

<replace file="..." token="${abc}" value="${xyz}" />

does not work, because the property values of abc and
xyz are substituted, before replace is executed.

I need a way to *escape* the property substitution
mechanism of Ant.

Ronald
Ronald Fischer - 27 Nov 2003 09:01 GMT
> If a property foo is defined, the string
>
[quoted text clipped - 5 lines]
> How can I pass the string literally, without
> substitution, to an ant task?

This can be done by using two $ signs in succession:

  $${foo}
Stefan Bodewig - 27 Nov 2003 09:13 GMT
> How can I pass the string literally, without
> substitution, to an ant task?

Double the $ sign.  I.e. use $${foo} and it turns into ${foo} literally.

Stefan


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.