gradle Exec:找不到命令

时间:2017-07-18 20:16:36

标签: gradle exec

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在目录下。我可以转到目录并手动运行命令

1 个答案:

答案 0 :(得分:0)

请你试试:

task runTest(type: Exec) {
    workingDir "$buildDir/test"
    commandLine 'cmd', '/c', 'test.bat'
}

,如docs