pepino jvm ERROR FALLIDO: La compilación falló con una excepción

4 minutos de lectura

Avatar de usuario de Elad Benda2
Elad Benda2

Intento ejecutar esta tarea gradle (a través de gradlew)

que usa pepino jvm

task callCL (type: Exec) {
    commandLine './build/distributions/WebLargeTests/bin/WebLargeTests  -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json --glue com.mayApp.testing.cucumber src/main/resources/features --tags ~@ignore -f rerun'
}

y obtener este error

:callCL FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':callCL'.
> A problem occurred starting process 'command './build/distributions/WebLargeTests/bin/WebLargeTests  -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json --glue com.myApp.testing.cucumber src/main/resources/features --tags ~@ignore -f rerun''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.448 secs
error=2, No such file or directory
3:48:00 PM: External task execution finished 'callCL'.

cuando ejecuto la misma línea desde la misma ruta en cmd:

/build/distributions/WebLargeTests/bin/WebLargeTests  -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json --glue com.myApp.testing.cucumber src/main/resources/features --tags ~@ignore -f rerun
Starting ChromeDriver (v2.9.248307) on port 12095
Starting ChromeDriver (v2.9.248307) on port 34150
Starting ChromeDriver (v2.9.248307) on port 29495
Starting ChromeDriver (v2.9.248307) on port 8792
Starting ChromeDriver (v2.9.248307) on port 23779
Starting ChromeDriver (v2.9.248307) on port 3553

actualización1:

este cmd funciona en una consola de shell:

./build/distributions/WebLargeTests/bin/WebLargeTests -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json –glue com.waze.testing.cucumber src/main/resources/ características –tags @only -f reejecutar

pero no en el build.gradle

task callCL (type: Exec) {
    commandLine 'bash', './build/distributions/WebLargeTests/bin/WebLargeTests', '-f',
            'html:build/reports/cucumber/', '-f', 'json:build/reports/cucumber/report.json', '--glue',
            'com.waze.testing.cucumber', 'src/main/resources/features', '--tags', '@ignore', '-f', 'rerun'

    //store the output instead of printing to the console:
    standardOutput = new ByteArrayOutputStream()

    //extension method stopTomcat.output() can be used to obtain the output:
    ext.output = {
        return standardOutput.toString()
    }
}

por cierto

Quiero que el cmd sea:

./build/distributions/WebLargeTests/bin/WebLargeTests -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json –glue com.waze.testing.cucumber src/main/resources/ características –etiquetas @only -f reejecutar –out reejecutar.txt

pero no en el build.gradle

task callCL (type: Exec) {
    commandLine 'bash', './build/distributions/WebLargeTests/bin/WebLargeTests', '-f',
            'html:build/reports/cucumber/', '-f', 'json:build/reports/cucumber/report.json', '--glue',
            'com.waze.testing.cucumber', 'src/main/resources/features', '--tags', '@ignore', '-f', 'rerun', '--out', 'rerun.txt'

    //store the output instead of printing to the console:
    standardOutput = new ByteArrayOutputStream()

    //extension method stopTomcat.output() can be used to obtain the output:
    ext.output = {
        return standardOutput.toString()
    }
}

pero esto no funciona (shell concole nore build.gradle)

  • Tienes commandLine mal definido seguro. Debería ser, por ejemplo: commandLine 'bash','script.sh'

    – Ópalo

    23 de julio de 2014 a las 13:01

  • agregado commandLine 'bash',' y obtuve: el proceso ‘comando ‘bash’ terminó con un valor de salida distinto de cero 127

    – Elad Benda2

    23 de julio de 2014 a las 13:08


  • Esto no es un problema de bash al comienzo del comando, pero todos los argumentos de comando deben ser eliminados con ' por separado.

    – Ópalo

    23 de julio de 2014 a las 13:10

  • así que ejecuté: ` task callCL (tipo: Exec) { commandLine ‘bash’, ‘./build/distributions/WebLargeTests/bin/WebLargeTests’, ‘-f’, ‘html:build/reports/cucumber/’, ‘- f’, ‘json:build/reports/cucumber/report.json’, ‘–glue’, ‘com.waze.testing.cucumber’, ‘src/main/resources/features’, ‘–tags’, ‘ @ignore’, ‘–out’, ‘rerun.txt’ }` y obtuve: `:callCL FAILED FAILURE: La compilación falló con una excepción. * Qué salió mal: Falló la ejecución de la tarea ‘:callCL’. > Proceso ‘comando ‘bash” terminado con valor de salida distinto de cero 1

    – Elad Benda2

    23 de julio de 2014 a las 13:17


  • Agregue manejo de salida para ver errores: gradle.org/docs/current/dsl/org.gradle.api.tasks.Exec.html

    – Ópalo

    23 de julio de 2014 a las 13:34

¡Mira si esto funciona!

Nota: Estoy usando la ruta /build/… en lugar de usar un punto primero y luego una barra inclinada: ./build/…

task callCL(type: Exec) {

        executable "bash"
        args "-c", "bash /build/distributions/WebLargeTests/bin/WebLargeTests -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json --glue com.waze.testing.cucumber src/main/resources/features --tags @only -f rerun"


        // If you want the store the output to a file, you can also try the following
        //args "-c", "bash /build/distributions/WebLargeTests/bin/WebLargeTests -f html:build/reports/cucumber/ -f json:build/reports/cucumber/report.json --glue com.waze.testing.cucumber src/main/resources/features --tags @only -f rerun 1>/some/path/somefile.log 2>&1"

        //store the output instead of printing to the console:
        standardOutput = new ByteArrayOutputStream()

        //extension method stopTomcat.output() can be used to obtain the output:
        ext.output = {
           return standardOutput.toString()
        }
}

¿Ha sido útil esta solución?