Gradle exec:在Windows上找不到命令
task runTest(type: Exec) {
workingDir "$buildDir/test"
commandLine 'test.bat'
}
错误:
Caused by: java.io.IOException: Cannot run program "test.bat" (in directory
"e:\foo\build\test"): CreateProcess error=2, The system cannot find the file
specified
但是test.bat在目录下。我可以转到目录并手动运行命令
最佳答案
您可以尝试:
task runTest(type: Exec) {
workingDir "$buildDir/test"
commandLine 'cmd', '/c', 'test.bat'
}
就像docs一样。