在 bash 中找不到 Ant 命令(Windows 32 位)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35263221/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 14:12:47  来源:igfitidea点击:

Ant command not found in bash (windows 32bit)

bashapachegithubantgit-bash

提问by Sheena Agrawal

I installed Apache ant using the link http://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/

我使用链接http://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/安装了 Apache ant

I am trying to build my files in git bash.
It shows the following error when I type ant:

我正在尝试在 git bash 中构建我的文件。
当我输入ant时,它显示以下错误:

bash:ant:command not found

I want to use cd buildcommand.

我想使用cd build命令。

采纳答案by VonC

Check your PATH when you are in the bash session.

在 bash 会话中检查您的 PATH。

echo $PATH

Don't forget that, after updating the PATH as mentioned in your link (through the Environment variable control panel), you need to open a newCMD session and launch git-bash.exein order for that session to inherit the modified PATH.

不要忘记,在更新链接中提到的 PATH 后(通过环境变量控制面板),您需要打开一个新的CMD 会话并启动git-bash.exe,以便该会话继承修改后的 PATH。

cd c:\path\to\git
git-bash.exe
echo $PATH

The OP confirms in the comment that the PATH is now:

OP 在评论中确认 PATH 现在是:

d/Users/h169717/bin:/mingw32/bin:/usr/local/bin:/usr/bin:/bin/:/mingw32/bin:/us???r/bin:/d/Users/h169717/bin:/c/Program Files/apache-ant-1.9.6/bin:/c/Program Files/Java/jre1.8.0_72/bin:/c/Program Files/apache-ant-1.9.6/bin:/usr/bin/vendor_perl:/usr/bin/core_perl

d/Users/h169717/bin:/mingw32/bin:/usr/local/bin:/usr/bin:/bin/:/mingw32/bin:/us???r/bin:/d/Users/h169717/ bin: /c/Program Files/apache-ant-1.9.6/bin:/c/Program Files/Java/jre1.8.0_72/bin:/c/Program Files/apache-ant-1.9.6/bin:/ usr/bin/vendor_perl:/usr/bin/core_perl

And antis working.

并且ant正在工作。