如何在 Mac 上设置 gradle

How set up gradle on Mac

最近从 Windows 迁移到 MacOS (El Capitan),因此在编译我的项目时遇到问题。

sh gradlew stage 

输出:

: command not found
: command not found
: command not found
: command not found
: command not found
'radlew: line 18: syntax error near unexpected token `{
'radlew: line 18: `warn ( ) {

我已经安装了 IntelliJ Idea IDE,安装了 Java,我是否在 MacOS 上进行了任何额外的设置? 我的最终目标是在 Heroku 上部署我的项目,现在我什至无法编译项目。所以任何帮助将不胜感激。

Gradle 包装文件 gradlew 本身就是一个 bash 脚本。您将通过 ./gradlew stage.

执行 Gradle 命令

gradle 包装器应该可以在 OS X 上正常工作,如果您之前生成了它的文件并将它们正确地签入到您的项目中。

或者甚至另外,您可以安装 gradle on a system-level with Homebrew 的 Mac 版本:

安装自制软件:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装gradle:

brew install gradle