Question: 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.

Answer: 
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.
I found, that using following solution is the easiest.

```
pushd somedir/dir && ant && popd

```

Although is seems to be to easy - it works.