JUnitJupiter 5.5.1依赖于JUnit平台1.3.2?
我觉得JUnitJupiter 5.5.1依赖于JUnit平台1.3.2?,junit,junit4,junit5,junit-jupiter,Junit,Junit4,Junit5,Junit Jupiter,我觉得junitjupiter 5.5.1不喜欢JUnit平台1.3.1。如果这两个测试都是在gradle依赖项中指定的,那么所有JUnit5测试都将被忽略。请参阅我的上一篇文章。例如,我认为以下组合不起作用: testImplementation('org.junit.platform:junit-platform-launcher:1.3.1') testImplementation('org.junit.jupiter:junit-jupiter-engine:5.5.1') testIm
junitjupiter 5.5.1
不喜欢JUnit平台1.3.1
。如果这两个测试都是在gradle依赖项中指定的,那么所有JUnit5测试都将被忽略。请参阅我的上一篇文章。例如,我认为以下组合不起作用:
testImplementation('org.junit.platform:junit-platform-launcher:1.3.1')
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.5.1')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.5.1')
相反,我必须使用以下组合。也就是说,junitplatformlauncher
必须是1.5.1
而不是1.3.1
:
testImplementation('org.junit.platform:junit-platform-launcher:1.5.1')
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.5.1')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.5.1')
那是几个月前的事了。今天,我才意识到在我的项目中,那些JUnit5测试又被忽略了。然而,在深入检查后,我发现了以下依赖链:
+--- org.junit.jupiter:junit-jupiter:5.5.1
| +--- org.junit.jupiter:junit-jupiter-api:5.5.1 -> 5.3.2
| | +--- org.apiguardian:apiguardian-api:1.0.0
| | +--- org.opentest4j:opentest4j:1.1.1
| | \--- org.junit.platform:junit-platform-commons:1.3.2
| | \--- org.apiguardian:apiguardian-api:1.0.0
| \--- org.junit.jupiter:junit-jupiter-params:5.5.1 -> 5.3.2
| +--- org.apiguardian:apiguardian-api:1.0.0
| \--- org.junit.jupiter:junit-jupiter-api:5.3.2 (*)
有人知道为什么这里的junitjupiter 5.5.1
依赖于junitplatformcommons 1.3.2
使用dependencyInsight提供的更多信息更新
根据中和中的讨论,->
表示存在依赖关系的“冲突解决”,我们可以使用任务dependencyInsight
获得更多的洞察力。我这样做了,但我仍然不太知道如何解释结果
clee@WS00509 MINGW64 ~/pg/dhpv2a (pg/gradle-6)
$ ./gradlew :profiler:dependencyInsight --configuration testCompileClasspath --dependency org.junit.jupiter:junit-jupiter
> Task :profiler:dependencyInsight
org.junit.jupiter:junit-jupiter:5.5.1 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
org.junit.jupiter:junit-jupiter:5.5.1
\--- testCompileClasspath
org.junit.jupiter:junit-jupiter-api:5.3.2 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
org.junit.jupiter:junit-jupiter-api:5.3.2
\--- org.junit.jupiter:junit-jupiter-params:5.3.2
\--- org.junit.jupiter:junit-jupiter:5.5.1 (requested org.junit.jupiter:junit-jupiter-params:5.5.1)
\--- testCompileClasspath
org.junit.jupiter:junit-jupiter-api:5.5.1 -> 5.3.2
\--- org.junit.jupiter:junit-jupiter:5.5.1
\--- testCompileClasspath
org.junit.jupiter:junit-jupiter-params:5.3.2 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
org.junit.jupiter:junit-jupiter-params:5.5.1 -> 5.3.2
\--- org.junit.jupiter:junit-jupiter:5.5.1
\--- testCompileClasspath
A web-based, searchable dependency report is available by adding the --scan option.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 6s
1 actionable task: 1 executed
我的最终目标就是让我的JUnit5测试运行起来。有什么办法吗
更新2--添加了渐变文件
gradle生成文件(和gradle.properties)列在该列表中。这是一个多项目生成,因此根目录有
build.gradle
,子项目之一的profiler
有profiler.gradle请提供完整的gradle文件。由于某些其他依赖项或插件,版本降级必须发生。@johanneslink--谢谢!我在开始的问题中添加了三个gradle文件,您使用的是Spring Boot 2.1.4,它在BOM中依赖JUnit jupiter 5.3.2。看见升级至最新的Spring Boot,或配置依赖项管理插件以使用所需的junit jupiter版本。@jbniset--Wow!谢谢我自己也应该抓到的。非常感谢!这回答了你的问题吗?