【发布时间】:2015-03-17 11:30:06
【问题描述】:
我编写了一个自定义任务copyDocs 将构建输出复制到其他目录,并在dependsOn 中给出了此任务,如下所示:
task doit(dependsOn: ['clean', 'build', 'copyDocs'])
build.mustRunAfter clean
copyDocs.mustRunAfter build
....
....
task copyDocs(type: Copy) {
from 'build/libs'
into 'build'
}
上面是自定义任务doit,它必须按照使用mustRunAfter 定义的顺序执行clean、build 和copyDocs。但它在执行过程中会出错。
During execution (i.e. cmd>gradle doit), I am getting the following error:
* What went wrong:
A problem occurred evaluating script.
> Could not find property 'copyDocs' on root project 'gradle'.
BUILD FAILED
请帮忙解决这个问题。
【问题讨论】:
-
请在写
copyDocs.mustRunAfter build之前尝试定义task copyDocs。
标签: java build gradle build.gradle