【问题标题】:How do I resolve this error on typing the "ant" command in Git shell如何解决在 Git shell 中键入“ant”命令时出现的此错误
【发布时间】:2015-01-09 06:18:53
【问题描述】:

我正在尝试使用 Git shell 从 Git 在我的 Windows PC 上构建存储库。 存储库的名称是“newrep”。

当我输入命令“ant”时,它会抛出以下错误 -

The term ant is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a patch was included, verify that the path is correct and try again.
At line: 1 char :4 + ant <<<< + CategoryInfo :ObjectNotFound: (ant:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

我该如何解决这个错误?

【问题讨论】:

  • 你安装Ant了吗?
  • 是的,它安装在C盘,我的github仓库在F盘。
  • PATH环境变量中是否列出了Ant二进制文件的目录?
  • 是的,那不见了。谢谢

标签: git shell ant repository


【解决方案1】:

我有一个设置ANT_HOME 并打印ant -version 输出的bat 文件。

powershell 执行此bat 文件后,如果我输入"ant -version",我会得到与上述相同的错误。

但是,如果我将 "ant all" 命令添加到同一个 bat 文件中,然后再次执行该 bat 文件,则它的执行没有任何问题。

所以我从中了解到的是,与command prompt 不同,powershell 没有设置本地会话属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-11
    • 2021-09-10
    • 1970-01-01
    • 1970-01-01
    • 2020-08-21
    • 2017-12-26
    • 2018-12-25
    • 2011-06-24
    相关资源
    最近更新 更多