程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了IntelliJ 上的 JUnit 版本警告大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决IntelliJ 上的 JUnit 版本警告?

开发过程中遇到IntelliJ 上的 JUnit 版本警告的问题如何解决?下面主要结合日常开发的经验,给出你关于IntelliJ 上的 JUnit 版本警告的解决方法建议,希望对你解决IntelliJ 上的 JUnit 版本警告有所启发或帮助;

我正在尝试在 IntelliJ 上运行测试方法,但是当我编译代码时,我收到以下报告的警告:

WARNING: Test@R_607_10846@ne with ID 'junit-vintage' Failed to discover tests
org.junit.platform.commons.JUnitException: Failed to parse version of junit:junit: 4.13.1
    at org.junit.vintage.@R_607_10846@ne.JUnit4Versioncheck.parseVersion(JUnit4Versioncheck.java:54)
    at org.junit.vintage.@R_607_10846@ne.JUnit4Versioncheck.checkSupported(JUnit4Versioncheck.java:37)
    at org.junit.vintage.@R_607_10846@ne.JUnit4Versioncheck.checkSupported(JUnit4Versioncheck.java:32)
    at org.junit.vintage.@R_607_10846@ne.VintageTest@R_607_10846@ne.discover(VintageTest@R_607_10846@ne.java:61)

在此警告后,编译器成功构建并且测试正常运行。 (我正在使用 gradle)

代码: img1

img2

img3

解决方法

您在 build.gradle 中声明了 JUnit 4 和 JUnit 5。

移除 JUnit 4 依赖:

testImplementation('junit:junit:4.13')

并在 IntelliJ 中重新同步/重新导入您的项目。

大佬总结

以上是大佬教程为你收集整理的IntelliJ 上的 JUnit 版本警告全部内容,希望文章能够帮你解决IntelliJ 上的 JUnit 版本警告所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。