【发布时间】:2015-11-28 08:40:25
【问题描述】:
我正在编写一个 gradle 任务。它调用的任务返回 3 表示成功运行,而不是 3。我该怎么做呢?
task copyToBuildShare(){
def robocopySourceDir = "build\\outputs\\apk"
def cmd = "robocopy "+ robocopySourceDir + " C:\\TEST *.* /MIR /R:5 2>&1"
exec {
ignoreExitValue = true
workingDir '.'
commandLine "cmd", "/c", cmd
if (execResult.exitValue == 3) {
println("It probably succeeded")
}
}
}
它给出了错误:
在任务中找不到属性“execResult”
我不想创建单独的任务。我希望它在 exec 块中。我做错了什么?
【问题讨论】:
-
常见错误:“ignoreExitValue = true”之间不要包含等号('=')。它应该只是“ignoreExitValue true”
标签: android gradle android-gradle-plugin build.gradle gradlew