gradle - 如何在 Gradle 构建文件中正确排除“junit-vintage-engine”?
问题描述
使用此配置时,我会收到initializationError
JUnit Vintage:
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
@RunWith
但是没有解决这个配置注释:
testImplementation (group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.7.0-M1'
}
如何正确排除 JUnit Vintage 模块?
解决方案
您只需要从排除规范中删除版本号(因为这将排除无论如何都不使用的特定版本):
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' // <- No version
}
}
test {
useJUnitPlatform()
}
推荐阅读
- node.js - FormData 一直抛出网络错误
- python - 在散点图图例中添加标签
- java - 如何配置 Maven 以在 Modulepath 中保留“Maven 依赖项”?
- c# - 需要从字符串拆分中取出两个值到数组中
- sql - SQL 中的逗号分隔(带大括号)搜索
- c# - 关于使用 MVVM 进行 UWP DataGrid 数据绑定的问题
- http2 - 为什么 Huffman 编码在 HTTP/2 HPACK 中是可选的?
- java - JPanel 显示不完整
- javascript - 调用 WCF 服务时出现 400 错误请求?
- math - 添加 8 位有符号幅度二进制数 - 二进制算术