所谓任务操纵,就是在任务定义后,对任务进行二次设置
如:增加依赖
task hello7<<{ println("Hello World7") } task hello8<<{ println("Hello World8") } task hello9<<{ println("Hello World9") } hello7.dependsOn hello8,hello9
zhangliuningdeMacBook-Pro:learning-gradle-demo01 sherry$ gradle -q hello7 Hello World8 Hello World9 Hello World7
增加任务行为
task hello10<<{ println("Hello World10") } hello10.doFirst{ println("Hello World10 First") }
zhangliuningdeMacBook-Pro:learning-gradle-demo01 sherry$ gradle -q hello10 Hello World10 First Hello World10
doFirst个doLast可以被多次调用,任务执行的时候按照添加的顺序执行 << 符号是doLast的简写
时间: 2024-11-05 17:20:37