Incompatible library version selenium / guava

2019-07-04 10:41发布

问题:

My app has a hard dependency on com.google.guava:guava:23.3 or superior

+--- com.github.ben-manes.caffeine:guava:2.6.0
|    +--- com.github.ben-manes.caffeine:caffeine:2.6.0
|    \--- com.google.guava:guava:23.3-jre (*)

But I am also using org.seleniumhq.selenium:selenium-java:3.0.1 which is incompatible with guava versions > 22.0 as discussed here:

https://github.com/SeleniumHQ/selenium/issues/4381

I am pretty new to Java, what is the best course of action here ?

I have looked into class loaders but that looks like a pretty deep rabbit hole.

回答1:

As you have a hard dependency on com.google.guava:guava:23.3 using org.seleniumhq.selenium:selenium-java:3.0.1 may put you on cross roads. But Selenium Release Notes clearly mentions the following guava dependencies :

  • Selenium v2.49.0 : Bump guava to version 19

  • Selenium v3.1.0 : Requires an update to the latest guava version 21.0

  • Selenium v3.5.0 : Bump guava to version 22.

  • Selenium v3.5.1 : Bump guava to version 23.

  • Selenium v3.12.0 : guava-23.6-jre

So Selenium v3.12.0 have got guava-23.6-jre which clearly fits to your requirement.