IntelliJ 上的 JUnit 版本警告
JUnit version warning on IntelliJ
我正在尝试 运行 IntelliJ 上的测试方法,但是当我编译代码时,我收到如下警告:
WARNING: TestEngine 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.engine.JUnit4VersionCheck.parseVersion(JUnit4VersionCheck.java:54)
at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:37)
at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:32)
at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:61)
在此警告之后,编译器成功构建并且测试工作。 (我正在使用 gradle)
代码:
img1
img2
img3
您在 build.gradle
中声明了 JUnit 4 和 JUnit 5。
删除 JUnit 4 依赖项:
testImplementation('junit:junit:4.13')
并且 re-sync/re-import 您在 IntelliJ 中的项目。
我正在尝试 运行 IntelliJ 上的测试方法,但是当我编译代码时,我收到如下警告:
WARNING: TestEngine 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.engine.JUnit4VersionCheck.parseVersion(JUnit4VersionCheck.java:54)
at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:37)
at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:32)
at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:61)
在此警告之后,编译器成功构建并且测试工作。 (我正在使用 gradle)
代码: img1
img2
img3
您在 build.gradle
中声明了 JUnit 4 和 JUnit 5。
删除 JUnit 4 依赖项:
testImplementation('junit:junit:4.13')
并且 re-sync/re-import 您在 IntelliJ 中的项目。