向gretty任务添加依赖项

时间:2015-11-27 15:21:41

标签: gradle build gretty

我在Gradle中使用the gretty plugin

它可以工作,我可以列出任务,例如appRun,并执行它们。

但是当我尝试使用

添加依赖项时找不到任务
apply plugin 'war'
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'

transpileScss << {
    ...
}

tasks.appRun.dependsOn transpileScss

我明白了:

Could not find property 'appRun' on task set.

会发生什么?如何在Gretty插件的任务中添加依赖项?

1 个答案:

答案 0 :(得分:7)

将逻辑包装到闭包中并将其传递给project.afterEvaluate

project.afterEvaluate {
   tasks.appRun.dependsOn transpileScss
}

在评估项目之前添加了Gretty任务。

相关问题