Adding a dependency to a gretty task
Asked Answered
C

1

5

I'm using the gretty plugin in Gradle.

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

But the tasks aren't found when I try to add a dependency with

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 happens? How can I add a dependency to tasks of the Gretty plugin?

Carmelo answered 27/11, 2015 at 15:21 Comment(0)
U
10

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

project.afterEvaluate {
   tasks.appRun.dependsOn transpileScss
}

Gretty tasks are added no sooner than project is evaluated.

Uraemia answered 27/11, 2015 at 15:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.