views:

24

answers:

1

Hi all,

I have my main build.xml which imports a common-build.xml from a shared directory. The common-build.xml imports a build.properties which is located in the same directory. At the moment I have to use a common.dir property which is set by the calling build.xml. If I just do

  <property file="build.properties"/>

Then it loads the build.properties relative to the "root" directory which is where build.xml is.

Can I do a relative load of build.properties from common-build.xml rather than build.xml?

+1  A: 

You can use relative path to refer location of property file.

Another related technique is to use dirname task from ant.

<project name="project tests" default="runtests" basedir=".">
<dirname property="some.basedir" file="${ant.file.project tests}"/>

The property "some.basedir" now refers to the build.xml file's directory.

Finally, you can always pass one property file on command line.

ant -propertyfile filepath

Jayan
Beautiful, thanks.
Mike Q