我的Gradle任务已停止在group
中显示description
和./gradlew tasks
,因为我已在根exec {}
中添加了build.gradle
。
发生了什么,我该如何取回?
task doSomething << {
group 'yourGroupName'
description 'Runs your bash script'
exec {
workingDir "$projectDir/../pathto/"
commandLine 'bash', '-c', './bashscript.sh'
}
}
其他一切都有效。
答案 0 :(得分:2)
您无法在doLast()
关闭
此代码
task doSomething << {
exec {
workingDir "$projectDir/../pathto/"
commandLine 'bash', '-c', './bashscript.sh'
}
}
与
相同task doSomething {
doLast {
exec {
workingDir "$projectDir/../pathto/"
commandLine 'bash', '-c', './bashscript.sh'
}
}
}
以下group
和description
未考虑
task doSomething {
doLast {
group 'yourGroupName'
description 'Runs your bash script'
exec {
workingDir "$projectDir/../pathto/"
commandLine 'bash', '-c', './bashscript.sh'
}
}
}
但它确实如此:
task doSomething {
group 'yourGroupName'
description 'Runs your bash script'
doLast {
exec {
workingDir "$projectDir/../pathto/"
commandLine 'bash', '-c', './bashscript.sh'
}
}
}