I am using spring-boot and gradle. I want to use latest selenium version, however half of compile dependencies, including drivers, are somehow 3.14 version. I tried invalidating caches, ./gradlew clean build
, ./gradlew build --refresh-dependencies
, but it doesn't help. My older project has the same dependencies (but no spring-boot) and I this issue is not present.
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
id 'org.springframework.boot' version '2.6.7'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'xxx.xxxxxx'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
implementation 'org.seleniumhq.selenium:selenium-java:4.1.4'
// https://mvnrepository.com/artifact/org.testng/testng
testImplementation 'org.testng:testng:7.5'
// https://mvnrepository.com/artifact/io.rest-assured/rest-assured
testImplementation 'io.rest-assured:rest-assured:4.5.1'
// https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager
implementation 'io.github.bonigarcia:webdrivermanager:5.1.1'
// https://mvnrepository.com/artifact/com.github.javafaker/javafaker
implementation 'com.github.javafaker:javafaker:1.0.2'
// https://mvnrepository.com/artifact/org.assertj/assertj-core
testImplementation 'org.assertj:assertj-core:3.22.0'
}
test {
useTestNG()
testLogging {
exceptionFormat(TestExceptionFormat.FULL)
}
systemProperties(System.getProperties())
}
CodePudding user response:
Spring Boot manages the versions for Selenium, so in your case you only specified the version for selenium-java
, all other versions were managed by Spring Boot. To properly update all Selenium dependencies, you have to override the property for the Selenium version:
ext['selenium.version'] = '4.1.4'
and remove the version from the selenium-java entry:
implementation 'org.seleniumhq.selenium:selenium-java'
You can find all available properties for libraries managed by Spring Boot in the documentation: https://docs.spring.io/spring-boot/docs/2.6.7/reference/htmlsingle/#appendix.dependency-versions.properties