#About Gradle# ##What is Gradle##
Gradle is build automation evolved. Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else.
Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. Powered by a Groovy DSL and packed with innovation, Gradle provides a declarative way to describe all kinds of builds through sensible defaults. Gradle is quickly becoming the build system of choice for many open source projects, leading edge enterprises and legacy automation challenges.
http://www.gradle.org/
##Gradle和Maven的比较##
-
gradle使用groovy作为build脚本,maven使用pom
-
maven配置:
-
4.0.0 com.douban.movie movie-parent pom 2.4.2-dev DoubanMovie com.google.android android 4.1.1.4 provided ```
* gradle配置:
```groovy
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
compileSdkVersion 17
buildToolsVersion '17'
}
```
-
gradle自定义task要比maven方便的多
task << { println "Hello World" } -
gradle的依赖管理更灵活 (Maven只能用artifact服务器上的包 gradle可以使用本地和maven仓库的包)
-
gradle受google官方支持
-
gralde的关于Android的包依赖更完善 Maven的已经很久没更新了
##Gradle安装##
-
Mac用户
brew install gradle
-
Linux用户 只是用包管理安装或者到
http://www.gradle.org/downloads来下载最新的二进制包 ###Android SDK###
最新的Android SDK Tools 最新的Android SDK Platform-tools Android SDK Build-toos 17 Android SDK Build-toos 18.0.1 Android SDK Platforms Android SUpport Repository Google Repository(如果需要)
##Gradle配置##
- gralde的配置语言使用的 DSL
- Android New Build System User Guide
##进阶##
- gralde wrapper
- aar file
- one workspace more modules
- gradle tasks
- gradle debug or gradle release