ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludwig, Michael" <>
Subject RE: Search for properties file in parent directories
Date Thu, 11 Nov 2010 18:02:58 GMT
Merci Antoine et Dominique!

> But may I inquire why you need that?

Of course. :-) I don't really need this, I was just wondering whether
it was possible. I could have maintained different configurations in
different subdirectories, overriding configurations in directories
higher up the tree. A user could descend into a directory, and Ant
would start to search for a configuration in the current directory,
recursively defaulting to the parent directory.

<!-- not implemented! -->
<property file="" start="${user.dir}" search="upwards"/>

It's probably a bad idea. Just forget about it. (And if you can't,
it's not too difficult to implement yourself.)

> In my experience, properties files are in known locations, either
> absolute, or more likely relative to the "basedir", or some file.

I probably wouldn't have thought of this, let alone asked the list,
if it weren't for ant's -s/-find command line option.

> For example, If in your case the .properties is in config/ relative to
> the build.xml that would found via the -s CLI switch, you can load the
> properties file using <property file="${basedir}/config/"
> />, whereas <property file="" /> uses either ${basedir}
> or the current directory (I don't remember which).

It uses ${basedir}, not the current directory:

        <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" />
        <property file="" prefix="pft"/>
        <echoproperties prefix="pft"/>

D:\dvinci\ant :: ant -e -f propfiletest.xml
Buildfile: D:\dvinci\ant\propfiletest.xml
#Ant properties
#Thu Nov 11 18:46:39 CET 2010

D:\dvinci\ant :: ant -e -f propfiletest.xml -Dbasedir=..
Buildfile: D:\dvinci\ant\propfiletest.xml
#Ant properties
#Thu Nov 11 18:46:41 CET 2010

D:\dvinci :: ant -e -f ant\propfiletest.xml
Buildfile: D:\dvinci\ant\propfiletest.xml
#Ant properties
#Thu Nov 11 18:49:03 CET 2010

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message