Thanks for that Steve. I would like to know more about "having the
webapp load these dynamically 
based on their hostname"....

Thanks

Rakesh

-----Original Message-----
From: Steve Loughran [mailto:[EMAIL PROTECTED] 
Sent: 24 October 2005 13:29
To: Ant Users List
Subject: Re: Specifying build properties


Rakesh Patel wrote:
> Hi,
> 
> Is there a way to specify which build file to use within a target?
> 
> I use my local machine for building the war for the development 
> environment and the production one. The properties are picked up from 
> build.properties but I have to change this file each time depending on

> where I am going to deploy to.
> 
> I would like separate tasks, one for each environment, and within the 
> target specify which property file to use (eg dev.properties, 
> prod.properties).
> 


Add a property into the mix to hold the name of the props

<target name="load-server-props">
  <fail unless="server.name">No server</fail>
  <properties file="conf/${server.name}.properties "/> </target>

<target name="war" depends="load-server-props">
  <war ...>
</target>

At the same time, I want to warn you about the perils of having 
different WAR files for different destinations, as you can be sure that 
the wrong version will eventually get onto the wrong box. There are 
better approaches from the most advanced, SmartFrog : 
http://people.apache.org/~stevel/slides/oscon.pdf , to a simpler 
technique I've used in the past: having a properties file for each 
system in the WAR file, and having the webapp load these dynamically 
based on their hostname.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



American Express Investments and American Express Independent Financial 
Advisers are marketing names for American Express Financial Services Europe 
Limited, a separate corporation within the American Express group of companies. 
 American Express Financial Services Europe Limited is authorised and regulated 
by, and is entered into the register (No. 190853 www.fsa.gov.uk/register/) of, 
the Financial Services Authority and a member of the London Stock Exchange. 
Registered in England No. 3614902. Registered address: 230 Blackfriars Road, 
London SE1 8NW. Vat No. 740 4143 68. 

The information in this email and any attachments is confidential and intended 
solely for the attention and use of the named addressee(s). It may be subject 
to legal, professional or other privilege and further distribution of it is 
strictly prohibited without our authority.  If you are not the intended 
recipient, you are not authorised to and must not disclose, copy, distribute, 
or retain this message or any part of it, and should notify us immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to