Adding a dependency to a complex task

I am using the gretty plugin in Gradle.

It works, I can list tasks, for example appRun, and complete them.

But no tasks were found when I try to add a dependency using

apply plugin 'war'
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'

transpileScss << {
    ...
}

tasks.appRun.dependsOn transpileScss

I get:

Could not find property 'appRun' on task set.

What's happening? How to add dependency on the tasks of the Gretty plugin?

+4
source share
1 answer

Wrap your logic in a closure and pass it project.afterEvaluate:

project.afterEvaluate {
   tasks.appRun.dependsOn transpileScss
}

Gretty tasks are not added until the project is evaluated.

+6
source

Source: https://habr.com/ru/post/1617758/


All Articles