Hi, I'm trying to automate our deploy process using ANT (since we using it for our build & ideally want to keep everything in ANT). For Deployment, I intend to store environment info in properties file, which ANT can fetch values from for each environment. However, found out that once a property value has been set in ANT, you can't change it i.e. can't use an ANT property as a variable.
Any tips or alternatives to solve this would be appreciated.
Cheers. --------- Sample of what I'm trying to achieve. In real life, my sequence would be, read env1 properties, deploy, read env2 properties, deploy & so on.
There's several ways to to this, but here's 2 I like to use:
1. Specify the build environment on the command line:
Note that I also have global and local property files here to allow additional specialized builds. As always, whoever sets a property first, wins.
Another way is essentially a variant of this. Make "build-development", "build-test", and "build-production" goals (or however you like) in the build.xml file. Set the properties in these goals, then use Antcall to recurse on Ant as though you'd set them on the command line. This can be good if you have lots of properties to set (but not enough to warrant an extra properties file). And, people don't have to know what the exact values to put on the original Ant command line are, since it doesn't need "-D" settings.
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 22, 2008
Thanks. I'll try your option# 2 which looks feasible.