I used to write:
<Exec dir = "$ {another. Project}" executable = "ant">
</Exec>
Result: Execute failed: Java. Io. ioexception: CreateProcess: ant error = 2
Later, I changed executable = "ant" to executable = "ant. Bat", and it succeeded.
The official document says:
Windows users
The<exec>Task delegatesRuntime.execWhich in turn apparently CILS::CreateProcess. It is the latter Win32 function that defines the exact semantics of the call. in particle, if you do not put a file extension on the executable, only ". EXE "files are looked for, not ". com ",". cmd "or other file types listed in the environment variable pathext. that is only used by the shell.
Note that. BatFiles cannot in general by executed directly. One normally needs to execute the command shell executablecmdUsing/cSwitch.
<target name="help"> <exec executable="cmd"> <arg value="/c"/> <arg value="ant.bat"/> <arg value="-p"/> </exec></target>