将依赖项添加到gretty任务 [英] Adding a dependency to a gretty task
本文介绍了将依赖项添加到gretty任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Gradle中使用 gretty插件。
它可以工作,我可以列出任务,例如 appRun
,然后执行它们。
但是,当我尝试添加一个依赖关系时,找不到任务
apply plugin'war'
适用于:'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
transpileScss<< {
...
}
tasks.appRun.dependsOn transpileScss
我得到:
在任务集中找不到属性'appRun'。
会发生什么?
解决方案
将您的逻辑封装到一个闭包中,并将它传递给 project.afterEvaluate
:
project.afterEvaluate {
tasks.appRun .dependsOpenpileScss
}
Gretty任务会在评估项目后立即添加。 p>
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?
解决方案
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.
这篇关于将依赖项添加到gretty任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文