Alb*_*ert 3 junit junit4 gradle junit5 junit-vintage
使用此配置时,我收到initializationErrorJUnit Vintage 的:
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
Run Code Online (Sandbox Code Playgroud)
但使用此配置@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'
}
Run Code Online (Sandbox Code Playgroud)
如何正确排除 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()
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5517 次 |
| 最近记录: |