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: 
You can try to use **subant** task:

Assuming you have two different folders 

1. Your current folder **X:/your/launching/folder** where you are executing **ant** command from
2. Folder where your destination bulid.xml is: **Y:/any/folder/with/build.xml**

You can do the following:

Create **build.xml** in **X:/your/launching/folder** with the next content:

```
<target name="mytarget">
    <subant target="debug">
        <fileset dir="Y:/any/folder/with" includes="build.xml"/>
    </subant>
</target>

```

Then you can execute **ant mytarget** from **X:/your/launching/folder** folder to start building your **Y:/any/folder/with/build.xml**

**Update:**

You can override **basedir** property for subant build like this:

```
    <subant target="debug">
        <property name="basedir" value="./any/dir/with/project"/>
        <fileset dir="Y:/any/folder/with" includes="build.xml"/>
    </subant>

```
another solution (if it makes more sense in some cases) could be to **override `basedir` via the `var` task** from the `antcontrib` extension as described here: <https://stackoverflow.com/a/25786329/1915920>