Gradle Installation on Mac OS X

Installation

refer link

看文档发现了一个好玩的东西:

For Un*x users

You need a GNU compatible tool to unzip Gradle, if you want the file permissions to be properly set. We mention this as some zip front ends for Mac OS X don’t restore the file permissions properly.

权限要正确被设置,注意下。

ENVIRONMENT VARIABLES

add GRADLE_HOME/bin to PATH.

TEST INSTALLATION

gradle -v

Build Scripts Basics

basic concepts: projects and tasks.

below is the build.gradle of JakeWharton/hugo. Take is as a start to learn gradle.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
allprojects {
  buildscript {
    repositories {
      mavenCentral()
    }
  }

  dependencies {
    repositories {
      mavenCentral()
    }
  }

  group = GROUP
  version = VERSION_NAME

  apply plugin: 'maven'
}

task wrapper(type: Wrapper) {
  gradleVersion = '1.8'
}

task cleanExample(type: Exec) {
  executable = 'gradle'
  workingDir = project.file('hugo-example')
  args = [ 'clean' ]
}

task assembleExample(type: Exec) {
  executable = 'gradle'
  workingDir = project.file('hugo-example')
  args = [ 'assemble' ]
}

task installExample(type: Exec) {
  executable = 'gradle'
  workingDir = project.file('hugo-example')
  args = [ 'installDebug' ]
}