[英]Error: Could not find or load main class cucumber.api.cli.Main
I try to run this gradle task 我尝试运行这个gradle任务
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'
}
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. 这是应该修改JavaExec
类路径的方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.