seleniumspring-bootintellij-ideagradlemaven-bom

How to use newer version of a library with Spring Boot


I am developing an application using Spring Boot 1.5.9.RELEASE, and I am using Gradle as build tool.

I want to use SelenumHQ 3.8.1 in the project.

When I was building the project I noticed that Selenium 2.53.1 was added to project (not 3.8.1), so I investigated and found out the reason.

There exists following statement in my build.gradle:

dependencyManagement {
    imports {
        mavenBom("org.springframework.boot:spring-boot-dependencies:1.5.9.RELEASE")
    }
}

and in that file selenium.version property is set to '2.53.1'.

So I have changed the statement to

dependencyManagement {
    imports {
        mavenBom("org.springframework.boot:spring-boot-dependencies:1.5.9.RELEASE") {
            bomProperty 'selenium.version', '3.8.1'
        }
    }
}

but now IDEA shows both 3.8.1 and 2.53.1 as dependencies of the project, and when I build the artifact using gradle, there only exists 2.53.1 dependencies and no sign of 3.8.1.

How can I change this behavior and use Selenium 3.8.1?

P.S. The Selenium is made of multiple jar files, so it is not just a single Jar file, and I want to update all of them in the most minimized using gradle.


Solution

  • I have found the answer in here.

    I shall override the property using: ext['selenium.version']='3.8.1' statement.