Reputation: 15472
I try to run this gradle task
task runCucumber(type: JavaExec) {
main = "cucumber.api.cli.Main"
args += ['-f', 'html:build/reports/cucumber/', '-f', 'json:build/reports/cucumber/report.json', '--glue', 'com.waze.testing.cucumber', 'src/main/resources/features'
, '--tags', '~@ignore', '--tags', '~@preRelease', '--tags', '@advil']
systemProperties['http.keepAlive'] = 'false'
systemProperties['http.maxRedirects'] = '20'
ignoreExitValue = true
}
and get this error:
Error: Could not find or load main class cucumber.api.cli.Main
why is that? I can find it in the included cucumber jar.
Edit
I already have this task that runs successfully:
mainClassName = "cucumber.api.cli.Main"
run {
args += ['-f', 'html:build/reports/cucumber/', '-f', 'json:build/reports/cucumber/report.json', '--glue', 'com.waze.testing.cucumber', 'src/main/resources/features'
, '--tags', '~@ignore', '--tags', '~@preRelease']
systemProperties['http.keepAlive'] = 'false'
systemProperties['http.maxRedirects'] = '20'
}
Upvotes: 4
Views: 29522
Reputation: 84776
The following script works in terms of proper configuration but fails since there are now features/test to check.
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
cucumber
}
dependencies {
cucumber 'info.cukes:cucumber-java:1.2.2'
}
task runCucumber(type: JavaExec) {
main = "cucumber.api.cli.Main"
args += ['-f', 'html:build/reports/cucumber/', '-f', 'json:build/reports/cucumber/report.json', '--glue', 'com.waze.testing.cucumber', 'src/main/resources/features'
, '--tags', '~@ignore', '--tags', '~@preRelease', '--tags', '@advil']
systemProperties['http.keepAlive'] = 'false'
systemProperties['http.maxRedirects'] = '20'
ignoreExitValue = true
classpath = configurations.cucumber
}
This is how JavaExec
classpath should be modified.
Upvotes: 2