Reputation: 151
When use this configuration I receive the initializationError
of the JUnit Vintage:
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
But with this configuration @RunWith
annotation isn't resolved:
testImplementation (group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.7.0-M1'
}
How can I correctly exclude the JUnit Vintage module?
Upvotes: 3
Views: 5934
Reputation: 101
It seems that for exclude you don't use group and name as parameters. You use group and module:
testImplementation (group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine', version: '5.7.0-M1'
}
And as already pointed by Bjørn Vester you don't need to specify the version.
Upvotes: 0
Reputation: 7598
You just need to remove the version number from the exclude specification (as that would exclude a particular version that is not used anyway):
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()
}
Upvotes: 5