后来发现问题原因是没有设置classpath,或者是\的原因:

正确配置如下:
  ANT_HOME:D:\ant\apache-ant-1.10.5

  CLASSPATH: %ANT_HOME%\lib

  PATH: %ANT_HOME%\bin

相关文章: