How to specify base dir then we run ant like ant -f somedir/dir/build.xml

ant, java

Solution

Use -D to override the basedir property:

ant -Dbasedir=`pwd` -f path/to/build.xml

The use of `pwd` is a Linux-only thing, but you can always put the absolute path of the current directory there if you're on another platform.

I don't think there's a way to do this inside build.xml, short of re-executing ant with the `ant` task.

Problem

How to specify base dir then we run ant like `ant -f somedir/dir/build.xml.` Ant sets basedir relative to build.xml, if I specify ``` <project basedir="." ..> ``` I would like to have basedir pointed to place where Ant is executed.

Original source