我已经安装了gcloud CLI,并且此命令在cmd或shell中运行正常:
gcloud compute scp --zone europe-west2-b build/libs/distribution-1.0.jar instance-1:distribution.jar
现在,我想创建一个执行相同任务的Gradle任务。受到我写的answer的启发
task deployGCloud(type: Exec) {
workingDir "$projectDir"
// on windows
commandLine 'gcloud', 'compute', 'scp'
args "--zone europe-west2-b"
args 'build/libs/distribution-1.0.jar'
args 'instance-1:distribution.jar'
}
deployGCloud.dependsOn bootJar
但是该任务失败并出现以下错误:
> Task :deployGCloud FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':deployGCloud'.
> A problem occurred starting process 'command 'gcloud''
CreateProcess error=2, The system cannot find the file specified
请给我一些有关如何解决它的建议。