我以前曾经使用过Maven几次,但我是Gradle的新手。我在Mac OS X 10.10.1上使用Intellij IDEA 14.0.2。我也有安装了rails的红宝石。 "宝石更新"表明我有最新的。 我也有啤酒和oh_my_zsh安装了最新的。
好的回到我的问题。我的目的是将一个小项目从Maven改为Gradle。我使用IDEA为Gradle创建了一个新模块:
apply plugin: 'java'
sourceCompatibility = 1.5
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
运行时的输出是:
/bin/bash /Users/lucianirimie/BCD/bcd-remote-tests/Gradle/build.gradle
zsh:1: command not found: plugin:
/Users/lucianirimie/BCD/bcd-remote-tests/Gradle/build.gradle: line 3: sourceCompatibility: command not found
/Users/lucianirimie/BCD/bcd-remote-tests/Gradle/build.gradle: line 4: version: command not found
/Users/lucianirimie/BCD/bcd-remote-tests/Gradle/build.gradle: line 6: repositories: command not found
/Users/lucianirimie/BCD/bcd-remote-tests/Gradle/build.gradle: line 8: syntax error near unexpected
令牌}'
/Users/lucianirimie/BCD/bcd-remote-tests/Gradle/build.gradle: line 8:
}'`
以下是我的.zshrc文件的内容
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=$PATH:/Users/lucianirimie/.rvm/gems/ruby-2.0.0-p247/bin:/Users/lucianirimie/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/lucianirimie/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/lucianirimie/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH="/usr/local/bin:$PATH"
[[ -s
brew --prefix /etc/autojump.sh ]] && .
brew --prefix /etc/autojump.sh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=$PATH:/Users/lucianirimie/.rvm/gems/ruby-2.0.0-p247/bin:/Users/lucianirimie/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/lucianirimie/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/lucianirimie/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH="/usr/local/bin:$PATH"
[[ -s
brew --prefix /etc/autojump.sh ]] && .
brew --prefix /etc/autojump.sh
答案 0 :(得分:1)
执行Gradle构建需要安装Gradle,或使用Gradle包装器。请查看Gradle docs以获取安装说明。我相信Gradle也可以通过Brew获得。通过在您的路径上正确注册gradle
命令,您可以构建类似于此项目的项目(来自包含 build.gradle 文件的文件夹。
$ gradle build