Which method in project is getting invoked when I

2019-08-13 23:59发布

问题:

I have defined a task in a gradle file as shown below:

task groupTherapy (dependsOn: yayGradle2) << {
    println 'This is not fun!'
}

I believe that below are the methods that get called when a task is defined:

Task    task(Map<String,?> args, String name)

Task    task(Map<String,?> args, String name, Closure configureClosure)

Task    task(String name)

Task    task(String name, Closure configureClosure)

Can you please explain me in my case which of these methods will get invoked? And help me understand why?

回答1:

Here you can find an answer that might be interesting. dependsOn: yayGradle2 will be passed as an instance of Map. The name of the task will be extracted internally by gradle and passed as a name.



标签: groovy gradle