ANT_HOME is set incorrectly or ant could not be lo

2019-03-12 04:58发布

This question already has an answer here:

I'm trying to build a project in Ant, using BuildFile (build.xml). Although ANT_HOME environment variable clearly exists and is set to the path where "ant.bat" is located, it always displays this error message. How to configure Ant properly to compile builds in Windows?

Thanks

9条回答
姐就是有狂的资本
2楼-- · 2019-03-12 05:35

If you are using Bamboo, make sure that the ant path in Bamboo setting is the same as your ANT_HOME.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-03-12 05:38

The ANT_HOME variable has to be a reference to the directory where the bin folder is found such as C:\Apps\apache-ant-1.8.4-bin\apache-ant-1.8.4\

The PATH reference can than be a reference to the ANT_HOME variable and the bin folder such as %ANT_HOME%\bin

example:

SET ANT_HOME=C:\Apps\apache-ant-1.8.4-bin\apache-ant-1.8.4\
SET PATH=%ANT_HOME%\bin
查看更多
干净又极端
4楼-- · 2019-03-12 05:38

Check your existing PATH that may already included. Ant will not work if path is duplicated.

查看更多
迷人小祖宗
5楼-- · 2019-03-12 05:40

I had the same problem and none of these solutions worked, so i simply deleted my ANT_HOME from enviroment variables, restarted my PC and I was all set to go

查看更多
闹够了就滚
6楼-- · 2019-03-12 05:41

Actually ANT_HOME should NOT be set where ant.bat is located.

It should be set to the ant.bat parent directory.

E.g.

C:\apache-ant-1.8.1 <-- ANT_HOME
  |
  bin <-- this is where ant.bat lives.

As duffymo correctly pointed out the ANT_HOME/bin still must be on your PATH.

查看更多
劳资没心,怎么记你
7楼-- · 2019-03-12 05:48

Just sharing my experience, using cd %ANT_HOME% can point out errors in setting the variable correctly.

  1. ANT_HOME should point to the parent directory, not the bin.
  2. Path should include %ANT_HOME%\bin
  3. The ant.bat file under bin is editable, it can be altered to print the current value for ANT_HOME for troubleshooting.
  4. A system reboot is probably required for the system variables to get updated.
查看更多
登录 后发表回答