2016-08-01 61 views

回答

1

使用从https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html的例子,你可以使自己的任务中执行贝茨像这样:

task runBats(type:Exec) { 
    workingDir '../dirWithMyBats' 
    //on windows: 
    commandLine 'cmd', '/c', 'bats', 'myBats.bats' 
    // OR on linux 
    commandLine 'bats', 'myBats.bats' 
} 

然后就是通过运行任务:gradle runbats,或进行另一个级别的任务会依赖它。

如果bats mybats.bat失败,那么任务和构建将失败。

相关问题