St.Antario St.Antario - 1 year ago 144
Groovy Question

What's the operator << (double less than) in gradle?

The following piece of code defines 4 gradle tasks:

4.times { counter ->
task "task$counter" << {
println "I'm task number $counter"

But what is the << operator? What does it do in groovy?

Answer Source

Basically this is a leftShift operator - You can find more details here.

In gradle << operator is used to add action to a particular task. A task consists of multiple actions that are run (in order they were added) during the execution of the task. << just adds an action to tasks collection of actions. More about tasks and actions can be found here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download