From f0a8e7863633b58f0590820b222323eba5749aa6 Mon Sep 17 00:00:00 2001 From: mposolda Date: Mon, 21 Sep 2020 14:24:22 +0200 Subject: [PATCH] KEYCLOAK-15635 Remove quarkus.index-dependency properties from application.properties --- .../quarkus/deployment/KeycloakProcessor.java | 15 +++++++++++++++ .../KeycloakPropertiesConfigSource.java | 3 +-- .../src/main/resources/application.properties | 4 ---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java index 394e72d542..d1fff7e3f6 100644 --- a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java @@ -29,10 +29,12 @@ import java.util.ServiceLoader; import io.quarkus.deployment.IsDevelopment; import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; +import io.quarkus.deployment.builditem.IndexDependencyBuildItem; import io.quarkus.hibernate.orm.deployment.HibernateOrmConfig; import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; import org.jboss.logging.Logger; +import org.jboss.resteasy.spi.ResteasyDeployment; import org.keycloak.Config; import org.keycloak.common.Profile; import org.keycloak.config.ConfigProviderFactory; @@ -159,6 +161,19 @@ class KeycloakProcessor { return "kc.home.dir".equals(name) || "kc.config.args".equals(name); } + /** + * This will cause quarkus tu include specified modules in the jandex index. For example keycloak-services is needed as it includes + * most of the JAX-RS resources, which are required to register Resteasy builtin providers. See {@link ResteasyDeployment#isRegisterBuiltin()}. + * Similar reason is liquibase + * + * @param indexDependencyBuildItemBuildProducer + */ + @BuildStep + void index(BuildProducer indexDependencyBuildItemBuildProducer) { + indexDependencyBuildItemBuildProducer.produce(new IndexDependencyBuildItem("org.liquibase", "liquibase-core")); + indexDependencyBuildItemBuildProducer.produce(new IndexDependencyBuildItem("org.keycloak", "keycloak-services")); + } + @BuildStep void initializeRouter(BuildProducer routes) { routes.produce(new FilterBuildItem(new QuarkusRequestFilter(), FilterBuildItem.AUTHORIZATION - 10)); diff --git a/quarkus/runtime/src/main/java/org/keycloak/configuration/KeycloakPropertiesConfigSource.java b/quarkus/runtime/src/main/java/org/keycloak/configuration/KeycloakPropertiesConfigSource.java index cebd79a28c..f516ac4e6c 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/configuration/KeycloakPropertiesConfigSource.java +++ b/quarkus/runtime/src/main/java/org/keycloak/configuration/KeycloakPropertiesConfigSource.java @@ -29,7 +29,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -128,7 +127,7 @@ public abstract class KeycloakPropertiesConfigSource extends PropertiesConfigSou /** * We need a better namespace resolution so that we don't need to add Quarkus extensions manually. Maybe the easiest - * path is to just have the "keycloak" namespace for Keycloak-specific properties. + * path is to just have the "kc" namespace for Keycloak-specific properties. * * @param key the key to transform * @return the same key but prefixed with the namespace diff --git a/quarkus/server/src/main/resources/application.properties b/quarkus/server/src/main/resources/application.properties index b26035a2d1..ead471a4d1 100644 --- a/quarkus/server/src/main/resources/application.properties +++ b/quarkus/server/src/main/resources/application.properties @@ -9,7 +9,3 @@ quarkus.http.root-path=/auth quarkus.application.name=Keycloak quarkus.banner.enabled=false -quarkus.index-dependency.kc-services-idx.group-id=org.keycloak -quarkus.index-dependency.kc-services-idx.artifact-id=keycloak-services -quarkus.index-dependency.liquibase-idx.group-id=org.liquibase -quarkus.index-dependency.liquibase-idx.artifact-id=liquibase-core