The following command will recursively search for ant build file in the directories and then its parent directories, till it finds it; and then executes it. In short you can use this command to manage your project from any subdirectory of the project.

ant -s [build file name]

If you are specifying a target on the commandline then you should specify it as follows:

ant target_name -s [build file name]

Note: build file name is optional; default is build.xml