错误:无法找到或加载主类cucumber.api.cli.Main [英] Error: Could not find or load main class cucumber.api.cli.Main

查看:14267
本文介绍了错误:无法找到或加载主类cucumber.api.cli.Main的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试运行这个gradle任务

 任务runCucumber(类型: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



<这是为什么?我可以在包含的黄瓜罐子里找到它。



编辑 我已经成功运行此任务:

  mainClassName =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']
systemProperties ['http.keepAlive'] ='false'
systemProperties ['http.maxRedirects'] ='20'
}


解决方案

以下脚本在正确配置方面有效,但由于现在有要检查的功能/测试,因此失败。



$ p $ apply plugin:'java'

repositories {
mavenCentral()
}

配置{
黄瓜
}

依赖关系{
cucumber'info.cukes:cucumber-java:1.2.2'
}

任务runCucumber类型: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 类路径的。


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

解决方案

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.

这篇关于错误:无法找到或加载主类cucumber.api.cli.Main的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆