引入了JUnit框架 却报错找不到:java.lang.ClassNotFoundException

完整报错如下:

Internal Error occurred.

org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests

at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)

at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)

at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)

at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)

at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99)

at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)

at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)

at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:63)

at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)

at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)

at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)

at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)

at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)

at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

Caused by: java.lang.NoClassDefFoundError: org/junit/jupiter/api/io/CleanupMode

at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:66)

at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)

... 13 more

Caused by: java.lang.ClassNotFoundException: org.junit.jupiter.api.io.CleanupMode

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528)

... 15 more

这里引入了junit但是却报错,找不到,大概率版本问题,改一个版本即可

相关推荐
weixin_5375904525 分钟前
《Spring boot从入门到实战》第七章习题答案
数据库·spring boot·后端
yc_xym28 分钟前
【MySQL】MySQL基础知识复习(上)
数据库·mysql
dogplays30 分钟前
neo4j desktop基本入门
数据库·neo4j
传说中高人33 分钟前
MySQL技巧之跨服务器数据查询:基础篇-删除语句如何写
数据库·mysql
Suwg2091 小时前
【mysql】基于城市多边形,配合mysql库,查询目标点是否在指定城市内
数据库·mysql
闲人一枚(学习中)1 小时前
spring -第十四章 spring事务
java·数据库·spring
Elastic 中国社区官方博客2 小时前
Elasticsearch 8.16:适用于生产的混合对话搜索和创新的向量数据量化,其性能优于乘积量化 (PQ)
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
月渐盈3 小时前
SQL:给数据表字段拼接字符串
数据库·sql
little_kid_pea3 小时前
MySQL LOAD DATA INFILE导入数据报错
数据库·mysql
woshilys3 小时前
sql server 查看io资源使用
数据库·sqlserver