Question

I'm trying to get Cucumber running from Gradle. When I try to execute Cucumber tests I get

Error: Could not find or load main class cucumber.api.cli.Main

Gradle downloaded the cucumber-jvm-1.1.3.pom file but none of the cucumber .jar files. Here is my build.gradle:

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile 'info.cukes:cucumber-jvm:1.1.3'
}


configurations {
    cucumberRuntime {
        extendsFrom testRuntime
    }
}

task runCucTests(type: JavaExec) {

    main = "cucumber.api.cli.Main"
    classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
    args = ['-f', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources', '--tags @complete', ' --format junit:target/reports/cucumber-junit-report/allcukes.xml', '--format pretty', '--format html:target/reports/cucumber-html-report']
}

I've tried changing the dependency to runtime and changing the cucumberRuntime to extend from runtime but the result is the same.

Why isn't gradle recognizing that it needs to download the cucumber .jar files?

Thanks.

Was it helpful?

Solution

cucumber-jvm is the parent group

cucumber.api.cli.Main requires cucumber-core

Use below:

dependencies {

compile "info.cukes:cucumber-core:1.1.3"

}

This will download the required jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top