0

I need to use two libraries in my Java Gradle project. Both of these libraries have a dependency to Google Guava (com.google.common).

The problem is that one library requires Guava 19.0, and the other requires Guava 23.0. The public API of Guava had some breaking changes between 19.0 and 23.0, so I cannot simply force the dependency to be solely Guava 23.0 (e.g. as proposed in this answer).

Is there any way to resolve this issue within Gradle itself?

Martin Häusler
  • 6,544
  • 8
  • 39
  • 66

1 Answers1

0

Short answer : no

Gradle does not support more than one version of the same library when compiling the code. The default behaviour is to take the newest one when a conflict is spotted but it can be changed overriding the Resolution Strategy

But in your case, none of these options will help you.

ToYonos
  • 16,469
  • 2
  • 54
  • 70
  • Which means, I'm out of luck? What other options are there? I never looked into the topic so far, but isn't there something like "shadow jars" or "shaded jars" that should help in such cases? – Martin Häusler Feb 14 '18 at 11:21