Gradle 命令操做

常规操做 – 使用帮助

  • Gradle Wrapper帮助命令行
./gradlew -?
./gradlew -h
./gradlew -help

查看全部可执行的Tasks

./gradlew tasks // 会以分组的形式列出全部的Task列表

Gradle Help任务

./gradlew help --task //显示tasks任务的帮助信息:类型、分组信息、可以使用的参数

强制刷新依赖

./gradlew --refresh-dependencies assemble

多任务调用

task compile {
    println 'compiling'
}


task compileTest(dependsOn: compile) {
    println 'compiling tests'
}


task test(dependsOn: [compile, compileTest]) {
    println 'test combination'
}
执行:
gradlew test
结果:
compiling
compiling tests
test combination

简介操做

  • 经过任务的缩写执行任务
执行gradlew te结果和上面的结果相同
结果:
compiling
compiling tests
test combination