java.lang.NoClassDefFoundError: org/junit/platform/engine/support/discovery/SelectorResolver
2022/2/8 1:43:40
本文主要是介绍java.lang.NoClassDefFoundError: org/junit/platform/engine/support/discovery/SelectorResolver,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
报错:
二月 07, 2022 9:59:52 下午 org.junit.platform.launcher.core.DefaultLauncher handleThrowable
警告: TestEngine with ID ‘junit-jupiter’ failed to discover tests
java.lang.NoClassDefFoundError: org/junit/platform/engine/support/discovery/SelectorResolver
at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:168)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:155)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner
R
e
p
e
a
t
e
r
.
s
t
a
r
t
R
u
n
n
e
r
W
i
t
h
A
r
g
s
(
I
d
e
a
T
e
s
t
R
u
n
n
e
r
.
j
a
v
a
:
33
)
a
t
c
o
m
.
i
n
t
e
l
l
i
j
.
r
t
.
j
u
n
i
t
.
J
U
n
i
t
S
t
a
r
t
e
r
.
p
r
e
p
a
r
e
S
t
r
e
a
m
s
A
n
d
S
t
a
r
t
(
J
U
n
i
t
S
t
a
r
t
e
r
.
j
a
v
a
:
235
)
a
t
c
o
m
.
i
n
t
e
l
l
i
j
.
r
t
.
j
u
n
i
t
.
J
U
n
i
t
S
t
a
r
t
e
r
.
m
a
i
n
(
J
U
n
i
t
S
t
a
r
t
e
r
.
j
a
v
a
:
54
)
C
a
u
s
e
d
b
y
:
j
a
v
a
.
l
a
n
g
.
C
l
a
s
s
N
o
t
F
o
u
n
d
E
x
c
e
p
t
i
o
n
:
o
r
g
.
j
u
n
i
t
.
p
l
a
t
f
o
r
m
.
e
n
g
i
n
e
.
s
u
p
p
o
r
t
.
d
i
s
c
o
v
e
r
y
.
S
e
l
e
c
t
o
r
R
e
s
o
l
v
e
r
a
t
j
a
v
a
.
n
e
t
.
U
R
L
C
l
a
s
s
L
o
a
d
e
r
.
f
i
n
d
C
l
a
s
s
(
U
R
L
C
l
a
s
s
L
o
a
d
e
r
.
j
a
v
a
:
381
)
a
t
j
a
v
a
.
l
a
n
g
.
C
l
a
s
s
L
o
a
d
e
r
.
l
o
a
d
C
l
a
s
s
(
C
l
a
s
s
L
o
a
d
e
r
.
j
a
v
a
:
424
)
a
t
s
u
n
.
m
i
s
c
.
L
a
u
n
c
h
e
r
Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.support.discovery.SelectorResolver at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher
Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)atcom.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)atcom.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)Causedby:java.lang.ClassNotFoundException:org.junit.platform.engine.support.discovery.SelectorResolveratjava.net.URLClassLoader.findClass(URLClassLoader.java:381)atjava.lang.ClassLoader.loadClass(ClassLoader.java:424)atsun.misc.LauncherAppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 8 more
解决方法:
1、Idea插件-Maven helper插件,找到所有冲突,选中红色的exclude掉。还是一样,没解决。
2、运行mvn dependency::tree
,仔细看一遍没看出问题。
3、运行mvn help:effective-pom
,得到最终的Maven文件结构。搜索文本 junit-jupiter-api(还有junit-jupiter-engine等),发现出现2个不同版本的(pom文件里是5.8.2,但是里面出来一个 5.3.2),换成5.3.2则没有报错了
出现原因:
不明确,之前没有加Springboot,单元测试还是正常的。又加了个springboot玩一下,再跑单元测试就突然报这个错误。
这篇关于java.lang.NoClassDefFoundError: org/junit/platform/engine/support/discovery/SelectorResolver的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23Springboot应用的多环境打包入门
- 2024-11-23Springboot应用的生产发布入门教程
- 2024-11-23Python编程入门指南
- 2024-11-23Java创业入门:从零开始的编程之旅
- 2024-11-23Java创业入门:新手必读的Java编程与创业指南
- 2024-11-23Java对接阿里云智能语音服务入门详解
- 2024-11-23Java对接阿里云智能语音服务入门教程
- 2024-11-23JAVA对接阿里云智能语音服务入门教程
- 2024-11-23Java副业入门:初学者的简单教程
- 2024-11-23JAVA副业入门:初学者的实战指南