tsundberg / gradle-cucumber-runner

A gradle plugin for running Cucumber-JVM
Apache License 2.0
20 stars 10 forks source link

java.io.IOException: Cannot run program "java": CreateProcess error=206, The filename or extension is too long #10

Closed cj19 closed 8 months ago

cj19 commented 8 months ago

Hi!

I have a build.gradle file with this configuration:

plugins {
    id "se.thinkcode.cucumber-runner" version "0.0.11"
}

cucumber {
    plugin = ['pretty', 'json:target/cucumber/cucumber.json', 'org.citrusframework.cucumber.CitrusReporter']
    glue = 'classpath:com.xy.tccm.integrationtests'
    tags = 'not @ignore'
    extraGlues = ['org.citrusframework.yaks.standard']

    main = 'io.cucumber.core.cli.Main'
    featurePath = 'src/test/resources/features'
}

dependencies {
    testImplementation project(':test-common')
    testImplementation project(':tollcharger-interfaces')

    testImplementation enforcedPlatform('io.cucumber:cucumber-bom:7.15.0')
    testImplementation enforcedPlatform('org.citrusframework:citrus-bom:4.1.0')

    // Cucumber dependencies
    testImplementation 'io.cucumber:cucumber-java'
    testImplementation 'io.cucumber:cucumber-junit'
    testImplementation 'io.cucumber:cucumber-spring'

    // Spring citrus dependencies
    testImplementation 'org.springframework:spring-test:6.1.3'
    testImplementation 'org.springframework.ws:spring-ws-security:4.0.6'

    // Citrus framework
    testImplementation 'org.citrusframework:citrus-base'
    testImplementation 'org.citrusframework:citrus-spring'
    testImplementation 'org.citrusframework:citrus-cucumber'
    testImplementation 'org.citrusframework:citrus-endpoint-catalog'
    testImplementation 'org.citrusframework:citrus-kafka'
    testImplementation 'org.citrusframework:citrus-validation-json'
    testImplementation 'org.citrusframework:citrus-validation-xml'
    testImplementation 'org.citrusframework:citrus-ws'
    testImplementation 'org.citrusframework.yaks:yaks-standard:0.17.1'
    testImplementation 'org.citrusframework.yaks:yaks-steps:0.17.1'
    testImplementation 'org.citrusframework.yaks:yaks-kafka:0.17.1'

    // Junit dependencies
    testImplementation 'org.junit.vintage:junit-vintage-engine:5.10.1'
}

compileJava {
    options.encoding = 'UTF-8'
    options.compilerArgs << '-parameters'
}

compileTestJava {
    options.encoding = 'UTF-8'
}

I also don't have steps config, because I use the predefined yaks steps to run the feature file, but when I try to run the tests using the plugin I get the following error:

Execution failed for task ':integration-tests:cucumber'.
> java.lang.RuntimeException: java.io.IOException: Cannot run program "java": CreateProcess error=206, The filename or extension is too long

What could be the issue?

tsundberg commented 8 months ago

I can't remember if I have seen this error before.

I would check is if the fact that you don't have any step definitions important or not. I don't know if that is the case or not.

Can you run a Java program from a command line? That is what the plugin does.

I would look at your path. Is it very long? There is a length limitation on some operating systems. And the error message indicates a long path.

If there is an error in the plugin, I would happily accept a pull request fixing the issue.

cj19 commented 8 months ago

I can't remember if I have seen this error before.

I would check is if the fact that you don't have any step definitions important or not. I don't know if that is the case or not.

Can you run a Java program from a command line? That is what the plugin does.

I would look at your path. Is it very long? There is a length limitation on some operating systems. And the error message indicates a long path.

If there is an error in the plugin, I would happily accept a pull request fixing the issue.

Yes, there was already a similar issue. But adding the .ManifestClasspath plugin can't solve it either.

plugins {
    id "se.thinkcode.cucumber-runner" version "0.0.11"
    id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}

Any ideas? @keychera

tsundberg commented 8 months ago

Ahh, I had of course forgotten about that issue.

keychera commented 8 months ago

@cj19 I didn't see you specified using shorten flag anywhere? have you tried using it?

you can use it either specifying the flag in the command you run or in the build.gradle file, like for example

cucumber {
    //...
    shorten = manifest
}
cj19 commented 8 months ago

thank you for your help, it solved the issue!

tsundberg commented 8 months ago

Thank you @keychera!