ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <>
Subject Re: Switch between environments
Date Mon, 10 Feb 2003 21:08:54 GMT
One way of solving your problem is the following :
- maintain in your source control system separate configuration files per
environment and if relevant per location,
- when you deploy, deploy the configuration files of the relevant
environment and location and the "fixed parts" of the application (config
independent); this means that you do not include environment dependent
information in war files or ear files, but rather put this information in
separate property files directly visible in the file system. Some source
control systems (Perforce) allow to create different client specs to map
your source repositories to file systems. You may want to create a special
repository for environment dependent information, and create a tree in this
repository beginning with //config/dev, //config/int, //config/prd and later
subdivided per location (for instance //config/dev/nyc, //config/dev/ldn,

Alternatively, you can build war, ear or jar files containing configuration
information; in this case also, you need to store your configuration
information in a tree which mirrors the main "segments" of your environment

You can "tell" ant for which environment you are working with :
    - an environment variable that your build script would use
    - a -Dname=value command line argument
    - a one liner property file containing for instance environment=dev for
development build, which you would change according to your current target

My personal preference is to :
   - check in all jar, ear, war files into SCM
   - make these files free of environment dependent properties
   - check in inside another parallel depot or repository the environment
dependent properties
     if the properties are in a LDAP server, you can also create a DIT which
begins with a separation dev/int/prd for instance
One advantage of having properties as stand alone files is that you can
easily inspect them, or hack them (so many cases when you need to deploy
applications with funny setups, especially in the initial stages).


----- Original Message -----
From: "White, Joshua A (CASD, IT)" <>
To: <>
Sent: Monday, February 10, 2003 9:38 PM
Subject: Switch between environments

> Hello All,
> When performing a build, is there any "best practice" ways of switching
> between environments (Meaning changing your environmental information from
> development to test or test to production).
> For example, I have an application that connects to an ldap directory and
> database.  What is the easiest way for me to switch out this application
> configuration information at build time so that my app will be deployed
> the correct information?
> Joshua
> This communication, including attachments, is for the exclusive use of
> addressee and may contain proprietary, confidential or privileged
> information. If you are not the intended recipient, any use, copying,
> disclosure, dissemination or distribution is strictly prohibited. If
> you are not the intended recipient, please notify the sender
> immediately by return email and delete this communication and destroy all
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message