Gradle 执行但仅在其自己的目录中

Gradle executes but only in its own directory

我试图安装 Gradle 但它似乎无法在其自己的 bin 目录之外工作。

我编辑了 PATH 和 gradle_home,所以它们都在所需的文件夹中。

C:\Users\shenj>gradle
'gradle' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\shenj>cd Downloads\gradle-2.4-all\gradle-2.4\bin

C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4\bin>gradle
:help

Welcome to Gradle 2.4.

To run a build, run gradle <task> ...

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle --help

To see more detail about a task, run gradle help --task <task>

BUILD SUCCESSFUL

Total time: 2.759 secs
C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4\bin>cd ..

C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4>gradle
'gradle' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4>echo %gradle_home%
C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4

C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4>echo %PATH%
C:\Program Files (x86)\BlueCoat\ProxyClient\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\Blue Coat\ProxyClient\; C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4\bin

我需要做些什么才能在我的项目文件夹中构建 gradle 吗?

在你的 PATH 分号之后有一个额外的 space:

...; C:\Users\shenj\Downloads\gradle-2.4-all\gradle-2.4\bin
    ^

我相信这是原因。