This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes How to modify an INI configuration file via ANT build.xml ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to modify an INI configuration file via ANT build.xml ?" Watch "How to modify an INI configuration file via ANT build.xml ?" New topic
Author

How to modify an INI configuration file via ANT build.xml ?

Jeff Tanner
Greenhorn

Joined: Aug 09, 2010
Posts: 6
Hi

Through an ANT build.xml, I want to modify a setting within a project's config.ini file.

For example, from default setting:
app_service_api=UNDEFINED

to a setting defined within build.xml:
app_service_api=QA

How can I do this

Thanks

Jeff in Seattle

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

You need to add a <filterchain> section to the <copy> task and use the <replacetokens> option (or some other filter chain option). See:
http://ant.apache.org/manual/Types/filterchain.html

Here is a discussion I had about this earlier this year:
http://www.coderanch.com/t/566206/tools/Modify-build-xml-replace-words#2571618


JBoss In Action
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to modify an INI configuration file via ANT build.xml ?
 
Similar Threads
Execute Ant script with Java file
PVCS task in ANT - unable t run from WSAD
calling perl program thru Ant task
ANT Task to modify XML files?
Eclipse and ANT