Adding a dependency to a gretty task

[亡魂溺海] 提交于 2019-12-23 12:56:15

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/33960409/adding-a-dependency-to-a-gretty-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!