gpt4 book ai didi

带有 doLast 的 Gradle exec 任务失败

转载 作者:行者123 更新时间:2023-12-04 04:25:17 25 4
gpt4 key购买 nike

仅当自上次构建以来已更新文件时,我才尝试运行 exec 任务。我最初的尝试是这样的:

task generateLocalizedStrings(type:Exec) {
ext.srcFile = file('../../../localization/language-files/en_US/wdmobilestringres.properties')
ext.destDir = new File("src/main/res")
inputs.file srcFile
outputs.dir destDir

doLast {
println "Executing localization script"
workingDir '../../../localization/'
commandLine 'python', 'localizationScript.py'
}
}

但是,这失败了“execCommand == null!”

我找到了一个解决方法,但我真的更喜欢一个合适的解决方案。
task generateLocalizedStrings(type:Exec) {
ext.srcFile = file('../../../localization/language-files/en_US/wdmobilestringres.properties')
ext.destDir = new File("src/main/res")
inputs.file srcFile
outputs.dir destDir

workingDir '../../../localization/'
commandLine 'python', 'dummyScript.py'

doLast {
println "Executing localization script"
workingDir '../../../localization/'
commandLine 'python', 'localizationScript.py'
}
}

最佳答案

你需要去掉 doLast阻止,而是配置 workingDircommandLine在那个街区之外。 (在任务运行后配置任务为时已晚。)

关于带有 doLast 的 Gradle exec 任务失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27929645/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com