ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lasher, James L" <jim.las...@hp.com>
Subject RE: Specifiying user properties file
Date Sun, 06 Nov 2005 00:56:19 GMT
Mark

You could either use the <available> condition something like:

<condition property="userpropsdefine" value="user.properties">
	<available file="C:/user.properties"/>
</condition>
<property name=userpropsdefine" value="default.properties"/>
<property file="${userpropsdefine}"/>

Ant's immutability of properties will only set the userpropsdefine
property to default.properties if user.properties does not exist.  Also,
if the userpropsdefine property was set within the condition it would
not be re-set for the same reason.  Of course you would need to adjust
this for whatever paths you are looking at.

Or, alternatively if you want to use an <if> structure check out
ant-contrib at
http://ant-contrib.sourceforge.net/ant-contrib/manual/tasks/.

Others may have other ideas.

-jim-

-----Original Message-----
From: Mark McKay [mailto:mark@kitfox.com] 
Sent: Saturday, November 05, 2005 5:43 PM
To: user@ant.apache.org
Subject: Specifiying user properties file

I'm trying to set up a situation where my users can specify a properties

file where they can set properties specific to their machines.  I have 
my main build.xml file checked into my CVS repostiory, and a 
default.properties file that is also in the CVS repository.  I'd like 
the init task of my ant script to check if a file called user.properties

exists, and if so to load properties from that file.  Otherwise, I'd 
like it to load properties fron the default.properties file.

Is there a way to do this (or something similar)?  Ant's lack of an <if>

task makes setting up something like this difficult.

Mark McKay

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


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


Mime
View raw message