We use keycloak-metrics-spi alongside with another custom SPI that uses prometheus libraries at runtime - this worked fine in the WildFly distribution, but on the Quarkus distribution, there is no classloader isolation between SPIs - all classes are shared. This lead to some ugly clashes, which we want to prevent by relocating all SPIs that use dependencies that aren't present on the Keycloak classpath by default.
What
Configures the maven-shade-plugin to relocate dependencies, and uses the gradle-shadow-plugin to relocate them in the gradle build
Why
The lack of classloader isolation in the Keycloak Quarkus distribution caused clashes between different SPIs that have dependencies
A small before and after of how the jars look on the inside:
Motivation
We use keycloak-metrics-spi alongside with another custom SPI that uses prometheus libraries at runtime - this worked fine in the WildFly distribution, but on the Quarkus distribution, there is no classloader isolation between SPIs - all classes are shared. This lead to some ugly clashes, which we want to prevent by relocating all SPIs that use dependencies that aren't present on the Keycloak classpath by default.
What
Configures the maven-shade-plugin to relocate dependencies, and uses the gradle-shadow-plugin to relocate them in the gradle build
Why
The lack of classloader isolation in the Keycloak Quarkus distribution caused clashes between different SPIs that have dependencies
A small before and after of how the jars look on the inside:
BEFORE:
AFTER: