ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Specifying build properties
Date Mon, 24 Oct 2005 12:29:13 GMT
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message