简体   繁体   English

尝试运行黄瓜文件时在Eclipse中运行错误

[英]run error in eclipse when trying to run cucumber file

This Error is appears when i trying to run junit test on eclipse using cucumber 当我尝试使用黄瓜在日食上运行junit测试时,会出现此错误

ava.lang.NoClassDefFoundError: cucumber/runtime/snippets/SummaryPrinter
    at cucumber.api.junit.Cucumber.run(Cucumber.java:90)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: cucumber.runtime.snippets.SummaryPrinter
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    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)
... 7 more

I got this error while upgrading the Cucumber version in my Maven based project. 在基于Maven的项目中升级Cucumber版本时出现此错误。

Turn out that I updated <artifactId>cucumber-java</artifactId> version from 1.1.5 to 1.2.4, but I didn't update <artifactId>cucumber-junit</artifactId> - it was still on 1.1.5. 原来我将<artifactId>cucumber-java</artifactId>版本从1.1.5更新到了1.2.4,但是我没有更新<artifactId>cucumber-junit</artifactId> -它仍然在1.1.5上。

On the moment I updated both to the same version, this error was gone. 当我将两个版本都更新到同一版本时,此错误消失了。

Class file that your code depends on and it is present at compile time but not found at runtime. 您的代码所依赖的类文件,该文件在编译时存在,但在运行时找不到。 Look for differences in your build time and runtime classpaths. 在构建时间和运行时类路径中寻找差异。

将cucumber-core,cucumber-java和cucumber-junit更新为相同的版本(我使用的是1.1.5版本)。问题已为我解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM