How to add keycloak-admin-client to an SPI?

I want to retrieve a (resource owner password credentials flow) token with a specific client using org.keycloak.admin.client.Keycloak:

Keycloak keycloak = KeycloakBuilder.builder() 

as in this example by Thomas Darimont.

I added keycloak-admin-client to the SPI jar by copying it into the /modules directory of Keycloak (the image shows the directory structure of the Docker build job, that whole tree is copied into Docker when building the image).

keycloak-cf-docker – europeana_eventlistener 2022-02-15 15-01-40

Keycloak can find the module, but I keep running into a ClassNotFoundException: whenever that above code is run.
I’d think that keycloak-admin-client should be able to find it because jboss-jaxrs-api_2.1_spec-2.0.1Final is provided by keycloak in /opt/jboss/keycloak/modules/system/layers/base/javax/ws/rs/api/main/, but apparently not.

I tried adding the dependencies explicitly to the SPI pom.xml, as in this SO question , but I keep getting this:

2022-02-15 13:39:26,588 ERROR [] (default task-1) Uncaught server error: java.lang.NoClassDefFoundError: javax/ws/rs/client/Client
at deployment.europeana-eventlistener.jar//eu.europeana.keycloak.user.UserRemovedMessageHandler.getKCClient(
Caused by: java.lang.ClassNotFoundException: from [Module "org.keycloak.keycloak-admin-client" version 16.1.0 from local module loader @59cba5a (finder: local module finder @1bd39d3c (roots: /opt/jboss/keycloak/modules,/opt/jboss/keycloak/modules/system/layers/keycloak,/opt/jboss/keycloak/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(

Any ideas how to fix that?