0

I have a plugin that has same name for its plugin extension and for task name (both are named plantUml).

I would like to run task before build. How can I do that?

When I type:

build dependsOn: plantUml

then I get information that it cannot be applied to plugin extension.

pixel
  • 24,905
  • 36
  • 149
  • 251

1 Answers1

3

It is possible to reference tasks via their names in methods like dependsOn and finalizedBy. This should be possible in both the Groovy and the Kotlin syntax:

build.dependsOn 'plantUml'

Tasks can also be referenced via the TaskContainer. The method getAt(...) provides a task based on its name. This method gets mapped to the array syntax in Groovy:

build.dependsOn tasks['plantUml']
Lukas Körfer
  • 13,515
  • 7
  • 46
  • 62