How to build SPI for Keycloak 17 (Quarkus)

Hello here

I’m not new to Keycloak, but still a little bit new to Maven build, because I’m using maven shade to pack my SPI and relevant artifacts. So using keycloak 6 to 16, everything was working fine.
But now after shade, I’m importing the jar into

COPY ./common-spi/target/common-spi.jar ${KEYCLOAK_DIR}/providers/common-spi.jar

and building all using

RUN ${KEYCLOAK_DIR}/bin/kc.sh build

and everything seems to be working fine.
BUT: During runtime I get java.lang.NoClassDefFoundError for so much classes that I’m using that I don’t understand the reason why I’ve done the build before.

Any idea?

1 Like

Ok, so I’ve changed my config and added these lines

<useTransitiveDependencies>false</useTransitiveDependencies>
<useTransitiveFiltering>true</useTransitiveFiltering>

Normally, just one line is sufficient. My reference was this Stackoverflow.com.

1 Like