2

I have recently come across some libraries which provide their jar files with their dependencies bundled with them (sometimes referred to as an uber jar, fat jar, or shaded jar thanks to Maven's Shade plugin).

The problem is that I have two libraries (A and B) which contain different versions of the same class file (same.fully.qulaified.class), and one of the libraries doesn't play nicely with the class file version in the other. I know I could play around with a custom classloader to sandbox the classes from A and B, but I'd rather go with a simpler, more standard solution if one exists.

Also, in general I'm surprised that these libraries are released as uber jars at all. It seems like when library providers package their dependencies in this way, this sort of problem is likely to show up.

So I have a couple questions:

1) Is it common and accepted practice for library providers to release uber jars?

2) Are there standard solutions to resolve conflicting transient dependencies (dependencies of dependencies) that show up at runtime when two of your required libraries have different versions of a class?

Community
  • 1
  • 1
augray
  • 3,043
  • 1
  • 17
  • 30
  • 1
    1) I'd say not, because it leads to issues exactly like this. – Andy Turner Oct 18 '15 at 22:54
  • 1
    2) a dependency manager like maven / gradle / .. and no uber jars. Uber jars are made for easy manual deployment. There should also be a version that doesn't do this but can be used via maven etc – zapl Oct 18 '15 at 23:07

0 Answers0