1、执行多个任务 关键词:dependsOn
示例: build.gradle:
task compile { doLast { println 'compiling source' } } task compileTest(dependsOn: compile) { doLast { println 'compiling unit tests' } } task test(dependsOn: [compile, compileTest]) { doLast { println 'running unit tests' } } task dist(dependsOn: [compile, test]) { doLast { println 'building the distribution' } }执行 gradle dist test :compile compiling source :compileTest compiling unit tests :test running unit tests :dist building the distribution
BUILD SUCCESSFUL
Total time: 1 secs
2、执行失败时不终止 添加 –continue将执行所有依赖没有失败的任务
3、简写 大小写敏感 gradle dist–>gradle di compileTest–>compTest –>cT
4、指定某个.build文件使用-b命令