向Gradle exec任务添加参数时没有此类文件或目录

时间:2017-06-27 14:08:59

标签: gradle

我正在制作运行bash脚本的任务

task wsUpload(type: Exec) {
  commandLine '../scripts/ws_upload.sh ' + rootProject.ext.VERSION_CODE
}

然而它返回

Caused by: java.io.IOException: Cannot run program "../scripts/ws_upload.sh 30" .... No such file or directory

如果我运行没有参数的相同命令

 task wsUpload(type: Exec) {
      commandLine '../scripts/ws_upload.sh'
    }

然后执行命令。我做错了什么?

1 个答案:

答案 0 :(得分:0)

添加这样的args

task wsUpload(type: Exec) {
      commandLine '../scripts/ws_upload.sh'
      args = ["args"]
    }