ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avlesh Singh <avl...@gmail.com>
Subject Replacing build variables in my application property files
Date Tue, 26 May 2009 16:36:59 GMT
I am dealing with a web application which has a huge list of build
parameters. This list ranges from multiple data sources, to REST based API
Url's, to HTTP connection properties ...  I need to replace these values at
build time in several confugiration/properties files residing in the
applications classpath. To name a few - Hibernate property files, Spring
property files etc.
Currently, I am accomplising this by having replacable tokens (e.g
_build.property_) in the above mentioned files. As a part of the build
process (mostly the "war" target), I replace these tokens (using the
replaceToken task) with their corresponding build property values. The only
unfortunate part about all this is that my build.xml file looks horrible,
mostly because, the files that I modified, need to be restored back to their
original state. Only the distribution war for the application is desired to
have those replaced values.

I have a few questions:

   1. Is there a better way of achieving this?
   2. If no, is a wrapper task worth an ant contribution? I am basically
   talking about a task which, given a fileset, would replace all occurences of
   ${build.property} in those files.

Cheers
Avlesh

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