ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian M. Savage" <jsav...@fisci.com>
Subject conditional loading of properties files
Date Fri, 22 Sep 2000 03:08:39 GMT
I'm wondering if there is any way to conditionally load a properties file.

I have two files, build.xml and test.properties in my example below, and as you can see, while
defining the property deploy prevents the echo from being executed, it doesn't prevent the
property file from being loaded, which is somewhat counter-intuitive. Is this expected/required
behaviour?

Thanks,

Julian.

Example:

# build.xml
<project name="fisci" default= "prepare" basedir=".">
        <target name="init.user" unless="deploy">
                <echo message="init.user"/>
                <property file="${user.home}/test.properties"/>
        </target>

        <target name="init" depends="init.user">
                <echo message="init"/>
                <property name="test.port" value="4100"/>
        </target>

        <target name="prepare" depends="init">
                <echo message="prepare"/>
                <echo message="test.port=${test.port}"/>
                <tstamp/>
        </target>
</project>
EOT

# test.properties
test.port=1234

$ ant prepare
Buildfile: build.xml

init.user:
init.user

init:
init

prepare:
prepare
test.port=1234

BUILD SUCCESSFUL

Total time: 0 seconds
$ ant -Ddeploy=yes prepare
Buildfile: build.xml

init.user:

init:
init

prepare:
prepare
test.port=1234

BUILD SUCCESSFUL

Total time: 0 seconds


Mime
View raw message