gpt4 book ai didi

windows - Windows:无法从Groovy脚本执行gradle命令

转载 作者:行者123 更新时间:2023-12-03 05:57:05 25 4
gpt4 key购买 nike

我正在尝试从groovy脚本运行gradle命令。
文件:file.groovy

def command = "gradle clean"
command.execute()

出现以下错误,
$ groovy file.groovy

Caught: java.io.IOException: Cannot run program "gradle": CreateProcess
error=2, The system cannot find the file specified
java.io.IOException: Cannot run program "gradle": CreateProcess error=2, The
system cannot find the file specified
at file.run(file.groovy:2)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot
find the file specified
... 1 more

同一文件在MAC上运行完全正常。

使用Gradle 3.0和Groovy 2.4.7

另外,如果直接运行 gradle clean ,它会按预期工作。

仅当从Windows系统上的groovy文件调用时才会出现问题。

在Windows cmd和cygwin上尝试过。同样的问题。

最佳答案

Tried on windows cmd as well as cygwin. Same issue.



我会说您在安装gradle时遇到问题。只要按照指示

https://docs.gradle.org/current/userguide/installation.html

并注意这一点:

3.4. Environment variables

For running Gradle, firstly add the environment variable GRADLE_HOME. This should point to the unpacked files from the Gradle website. Next add GRADLE_HOME/bin to your PATH environment variable. Usually, this is sufficient to run Gradle.

关于windows - Windows:无法从Groovy脚本执行gradle命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44228693/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com