ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kanjo, Samer" <SKa...@tribune.com>
Subject Targeting Multiple Environments
Date Wed, 31 May 2006 13:25:54 GMT
I am curious as to how others are using Ant to target multiple environments
such as development, test, training, and production. In my world each
environment typically has its own set of databases, servers, and application
servers.

What I have done is externalize all properties into a set of property files
that end with the target environment name (The target environment names are
dev, test, train, and prod). So if I had a properties file named
"myprops.xml" included in the build I would create one for each environment
naming the files as such: "myprops.xml.dev", "myprops.xml.test",
"myprops.xml.train", "myprops.xml.prod". The build script would check for an
environment variable named TARGET_ENV and attempt to load the file
"myprops.xml" suffixed with the value of TARGET_ENV. Once loaded all the
properties associated with that target are available to the build script.

In order for this to work I must specify a value for TARGET_ENV on the
command line. To simplify the command line I created a batch/shell script
that accepts the target environment and a set of Ant targets and creates the
command line used to invoke Ant.

This works fine but I am just not happy with the solution. I have searched
the web for solutions others have created for this problem but it doesn't
seem to be anything anyone really talks about or I am looking in the wrong
places.

So what have you done?

Samer Kanjo


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


Mime
View raw message