jeudi 28 juin 2018

Gradle refuse to start process command 'cmd'

I'm encountering issue with a custom gradle task. Seems like gradle refuse to start a command line process.

Here is the custom task:

task generateAllure(type: Exec) {
    workingDir "$projectDir/allure/bin"
    if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
        commandLine 'cmd', '/c', 'allure.bat', 'generate', '-c', '../../integration/build/allure-results'
    } else {
        commandLine 'bash', '-c', 'allure', 'generate', '-c',"$projectDir/integration/build/allure-results"
    }
}

tasks.withType(Test)*.finalizedBy generateAllure

With the appropriate dependency:

compile group: 'ru.yandex.qatools.allure', name: 'allure-commandline', version: '1.4.18'

After using gradle clean test execution fails on:

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateAllure'.
> A problem occurred starting process 'command 'cmd''

Any thoughts about that? Thanks!

1 commentaire: