Antcall: Call nested ant target from another file

ant, antcall, file

Solution

You may try:

<ant antfile="otherFile.xml" target="secondTarget"/>

And no need to include the otherFile.

Problem

I have two ant files: 1) Main file ``` <include file="otherFile.xml" as="otherFile"/> <target name="firstTarget"> <antcall target="otherFile.secondTarget"/> </target> ``` 2) Utilities file ``` <target name="secondTarget"> <antcall target="thirdTarget"/> </target> <target name="thirdTarget"> <echo message="ok"/> </target> ``` When I invoke the `firstTarget` it says it cannot find the `thirdTarget`. If I change the `secondTarget` this way: ``` <target name="secondTarget"> <antcall target="otherFile.thirdTarget"/> </target> ``` then it works. But then I cannot use secondTarget directly. Because the second file does not knwon the prefix otherFile

Original source