我尝试在Intellij中运行测试,这在Sping Boot 2.2.x中以前是可以工作的。我最近升级到了Sping Boot 2.3.9。当我尝试从Run Configurations运行测试时,它不运行测试并抛出错误:
'无法解析junit platform launcher 1.6.3 intellij'。
但是,如果我在cli中运行测试,它工作正常。
我尝试在Intellij中运行测试,这在Sping Boot 2.2.x中以前是可以工作的。我最近升级到了Sping Boot 2.3.9。当我尝试从Run Configurations运行测试时,它不运行测试并抛出错误:
'无法解析junit platform launcher 1.6.3 intellij'。
但是,如果我在cli中运行测试,它工作正常。
6条答案
按热度按时间pbwdgjma1#
事实证明,为了让Junit 5测试在IntelliJ中运行,需要添加junit 5-platform-launcher依赖项。
https://youtrack.jetbrains.com/issue/IDEA-231927?_ga=2.5997872.2063517257.1613993298-1098513328.1597974168
https://junit.org/junit5/docs/current/user-guide/#running-tests-ide-intellij-idea
在pom.xml中显式地添加这个依赖项,它将解决这个问题。
sshcrbum2#
我遇到了同样的问题“无法解决junit平台启动器1.8.1”intellij。IntellJ版本:2021.3
我找到了答案here,它工作了,不需要添加任何依赖到pom。
进入设置>> HTTP代理>>选择自动检测代理设置
xeufq47z3#
对于IntelliJ Idea 2021.1,我修复了一个类似的问题:
也许更好的解决方法是:
Found the above solution on Jetbrains issue tracker
e4eetjau4#
如果你没有直接的互联网连接,但是有一个像artifactory这样的仓库管理器,idea会尝试从那里解析junit-platform-launcher。确保你有一个镜像到maven中央存储库(虚拟存储库)配置和artifactory url到这个镜像是可访问的,无需身份验证(在设置的存储库“强制身份验证”应取消选中)。检查idea代理设置,如果需要,为artifactory域配置一个例外。
hm2xizp95#
在IntelliJ Idea设置中检查代理设置。我打开了代理,它解决了这个问题。
pw9qyyiw6#
我尝试在pom.xml中添加以下依赖项,它对我有效。