Java 找不到 Gradle 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37019029/
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
Gradle Command Not Found
提问by cain4355
So I recently made the jump from Ant
to Gradle
and it is wonderful. However, I am having some issues getting gradle to run from a server.
所以我最近从Ant
to跳了Gradle
下来,这很棒。但是,我在从服务器运行 gradle 时遇到了一些问题。
I have a script that I can manually execute to run all of my gradle tasks to build my app. This works perfectly when I am logged into the machine. The problem is that I am now trying to kick off that script for a nightly build. And in order to kill two birds with one stone I launched a JBoss
server with a custom service to call that script nightly and call the script with a specific hooks from GitHub.
我有一个脚本,我可以手动执行它来运行我的所有 gradle 任务来构建我的应用程序。当我登录到机器时,这非常有效。问题是我现在正试图为每晚构建启动该脚本。为了一石激起二鸟,我启动了一个JBoss
带有自定义服务的服务器,每晚调用该脚本,并使用来自 GitHub 的特定钩子调用该脚本。
Does anyone know what the difference would be between calling the script when I am logged into the machine and having a server (which I started when I was logged in) call the same script?
有谁知道当我登录到机器时调用脚本和让服务器(我在登录时启动)调用相同的脚本之间有什么区别?
The only information I get from the console:
我从控制台获得的唯一信息:
gradle: command not found
采纳答案by Batiaev
As say @TobiSH First of all check your environment echo $GRADLE_HOME && echo $PATH
正如@TobiSH所说首先检查您的环境 echo $GRADLE_HOME && echo $PATH
Path to gradle
can be setting up only for your user and not for all system
Path togradle
只能为您的用户设置,不能为所有系统设置
.profile
or .bashrc
instead of /etc/environment
(for linux systems)
.profile
或.bashrc
代替/etc/environment
(对于 linux 系统)
Second option is try to use gradle wrapper
第二种选择是尝试使用gradle 包装器
$ gradle wrapper
to be more independent from your environment
更独立于你的环境
You can read more about different user and system variable here(windows)
您可以在此处阅读有关不同用户和系统变量的更多信息(Windows)
For ubuntu and other linux based systems here
对于 ubuntu 和其他基于 linux 的系统,请点击此处