没有看懂定义 task 的这种语法。看了groovy 的也没有看懂task的定义
来源:8-2 Task定义和配置

坤少sir
2022-08-17
task helloTask {
println “this is task”
}
相当于调用了 task 的一个方法么?
task(helloTask) {
println “this is task”
}
但是 task 传入的不是一个 String 类型么?
应该是
task(‘helloTask’){
println “this is task”
}
那这样是不是 helloTask 等价于 ‘helloTask’, 传入的参数自动变成 string 么?
写回答
1回答
-
qndroid
2022-08-26
task helloTask {} 是脚本写法, task( ‘helloTask’) {} 是我们常见的面向对象写法; groovy即有面向对象的特性,也要脚本的特性,所以两种写法风格都没有问题,看人个或团队整体风格选择使用即可;
00
相似问题