gpt4 book ai didi

java - 线程 "main"java.lang.NoClassDefFoundError : gherkin/lexer/Encoding 中出现异常

转载 作者:行者123 更新时间:2023-12-01 09:37:10 25 4
gpt4 key购买 nike

您好,当我在 Eclipse 中运行功能文件时出现错误。

我确实有最新的 cucumber jar ,但仍然没有运气。关于如何解决的任何想法?我还指出了

这是我的代码:

package Cucumber;
import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
format = {"pretty", "json:target/"},
features = {"src/cucumber/"}
)
public class CucumberRunner {

}

这是我的功能文件。

    Feature: My Feature
Scenario: Title of your scenario
Given This is my first test
And This is my second test
Then This is my final test

这是我收到的错误。

Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/lexer/Encoding
at cucumber.runtime.FeatureBuilder.read(FeatureBuilder.java:154)
at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:115)
at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:104)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34)
at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:235)
at cucumber.runtime.Runtime.run(Runtime.java:110)
at cucumber.api.cli.Main.run(Main.java:36)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException: gherkin.lexer.Encoding
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 9 more

最佳答案

尝试 Cucumber-core 、 cucumber-java 和 cucumber-junit jars 作为 1.2.0 和 gherkin 版本 2.12.2 ,在几次失败后,它对我来说用这个组合工作。

关于java - 线程 "main"java.lang.NoClassDefFoundError : gherkin/lexer/Encoding 中出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38790510/

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