5

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.

Amir Pashazadeh
  • 7,170
  • 3
  • 39
  • 69

2 Answers2

5

I have found the answer in here.

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

Amir Pashazadeh
  • 7,170
  • 3
  • 39
  • 69
0

When IntelliJ imports the dependencies, it will not remove old dependencies like this.

You would have to clean it out, then re-import the dependencies. Of course, another dependency might also have a dependency on 2.53.1 that would bring it in again.

I don't know Gradle, but maven you can do a mvn tree dependency that would list all the dependencies and further down and you can look through it to see if selenium is a dependency for another dependency too.

bytor99999
  • 726
  • 7
  • 26
  • I have removed and readded the dependency multiple times, but the problem still exist in Idea. – Amir Pashazadeh Jan 03 '18 at 00:04
  • I recommend getting the dependency tree to print out and search for selenium in the results. In maven it is mvn dependency:tree I recommend using the link I posted below to get the gradle version of dependency tree to see if anywhere else you have a transitive dependency on Selenium with a different version. – bytor99999 Jan 03 '18 at 02:30
  • Here is a link in StackOverflow for getting the tree in Gradle. https://stackoverflow.com/questions/21645071/using-gradle-to-find-dependency-tree – bytor99999 Jan 03 '18 at 02:30