3

Context

While compiling and running Java programs that use a lot of dependencies you can easily run into the so-called "class path hell" that is usually caused by clashing transitive dependencies. With the Gradle dependency mechanism for java this can be mitigated to some extent by at least not leaking transitive dependencies at compile time (link).

As I understand it, when one runs into issues with clashing transitive dependencies there are pretty much three ways:

  • Find another library (version) and hope it works
  • Shade the transitive dependencies
  • (new) Use layering for modules

Question

As we have both the mechanisms for defining implementation dependencies and shading them (i.e. changing their namespace at run time) do you know if there is an automatic way of shading all implementation dependencies? The shaded pattern could use the artifactId that needs to be unique anyway.

As an alternative, is there an automatic way to use the new "module layering" system?

Background

I already asked in the past how to avoid the clash between a successful compilation and runtime load errors SO Question. I have also checked how to resolve dependency clashes with disabling transitive dependencies and shading in fat jar. I also saw that the Java module system won't be intended to solve it link, but layering of the jigsaw project might link

0 Answers0