gpt4 book ai didi

java - 错误 : Could not find or load main class cucumber. api.cli.Main

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:01:21 27 4
gpt4 key购买 nike

我尝试运行这个 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
}

并得到这个错误:

错误:无法找到或加载主类 cucumber.api.cli.Main

这是为什么呢?我可以在随附的 cucumber jar 中找到它。

编辑

我已经成功运行了这个任务:

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'
}

最佳答案

以下脚本在正确配置方面工作但失败,因为现在有功能/测试要检查。

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
}

这就是应该如何修改 JavaExec 类路径。

关于java - 错误 : Could not find or load main class cucumber. api.cli.Main,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28794397/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com