0

I read how we can omit parenthesis and dots to use groovy as a DSL. Due to which thought that task is a method.

But I'm confused if task is a method of the form def task(String name, Closure closure). Then a task would be declared in DSL as task "taskname", {}. But actually, it is task taskname {}.

Why doesn't groovy misinterpret taskname as a variable name here? And if task is not a method what is it?

Manesidlapy
  • 39
  • 1
  • 7

1 Answers1

0

It is a feature provided by the Gradle DSL. The token following task is turned into a String if it doesn't refer to another property. See https://stackoverflow.com/a/59803371