gpt4 book ai didi

eclipse - 无法在Jipster示例应用程序Gradle中运行Eclipse中的Junits

转载 作者:行者123 更新时间:2023-12-03 05:25:14 28 4
gpt4 key购买 nike

我检查了https://github.com/jhipster/jhipster-sample-app-gradle将项目导入到eclipse版本中:2020-03(4.15.0),已安装gradle插件。当我尝试运行Junit测试时,右键单击->以Junit运行,我不断

java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener
at org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.getLauncherDiscoveryListener(LauncherDiscoveryRequestBuilder.java:241)
at org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.build(LauncherDiscoveryRequestBuilder.java:235)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createUnfilteredTest(JUnit5TestLoader.java:75)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:66)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:53)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:526)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.EngineDiscoveryListener
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)
... 21 more

我尝试遍历所有内容,但找不到有效的解决方案,有人遇到了同样的问题并得到解决,请提供解决方案

最佳答案

爱好者,
只需添加

testImplementation('org.junit.platform:junit-platform-launcher:1.5.2')
build.gradle 文件的“依赖项”部分,刷新gradle(在eclipse上,在项目> Gradle> Refresh Gradle Project的上下文菜单上)。您应该能够一个一个地运行测试。
快乐编码

关于eclipse - 无法在Jipster示例应用程序Gradle中运行Eclipse中的Junits,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61597549/

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