From 18c67f51ce9312f64c4bfb19f462db2c03b08d6d Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Thu, 29 Oct 2020 21:06:03 -0300 Subject: [PATCH] KEYCLOAK-16066 KEYCLOAK-14255 Unable to build Keycloak distribution on Windows due to io.quarkus.builder.BuildException failure * file separator removed from KeycloakPropertiesConfigSource.java Signed-off-by: Peter Zaoral fixing windows --- .../quarkus/deployment/KeycloakProcessor.java | 26 +++++++++---------- .../KeycloakPropertiesConfigSource.java | 3 +-- 2 files changed, 14 insertions(+), 15 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 57eb2b8b1a..a01fdc3eae 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 @@ -73,13 +73,13 @@ class KeycloakProcessor { /** *

Configures the persistence unit for Quarkus. - * - *

The main reason we have this build step is because we re-use the same persistence unit from {@code keycloak-model-jpa} + * + *

The main reason we have this build step is because we re-use the same persistence unit from {@code keycloak-model-jpa} * module, the same used by the Wildfly distribution. The {@code hibernate-orm} extension expects that the dialect is statically * set to the persistence unit if there is any from the classpath and we use this method to obtain the dialect from the configuration * file so that we can build the application with whatever dialect we want. In addition to the dialect, we should also be * allowed to set any additional defaults that we think that makes sense. - * + * * @param recorder * @param config * @param descriptors @@ -88,7 +88,7 @@ class KeycloakProcessor { @BuildStep void configureHibernate(KeycloakRecorder recorder, HibernateOrmConfig config, List descriptors) { PersistenceUnitDescriptor unit = descriptors.get(0).asOutputPersistenceUnitDefinition().getActualHibernateDescriptor(); - + unit.getProperties().setProperty(AvailableSettings.DIALECT, config.defaultPersistenceUnit.dialect.dialect.orElse(null)); unit.getProperties().setProperty(AvailableSettings.JPA_TRANSACTION_TYPE, PersistenceUnitTransactionType.JTA.name()); unit.getProperties().setProperty(AvailableSettings.QUERY_STARTUP_CHECKING, Boolean.FALSE.toString()); @@ -97,9 +97,9 @@ class KeycloakProcessor { /** *

Load the built-in provider factories during build time so we don't spend time looking up them at runtime. By loading * providers at this stage we are also able to perform a more dynamic configuration based on the default providers. - * + * *

User-defined providers are going to be loaded at startup

- * + * * @param recorder */ @Record(ExecutionTime.RUNTIME_INIT) @@ -119,19 +119,19 @@ class KeycloakProcessor { key -> new HashMap<>()) .computeIfAbsent(entry.getKey().getProviderClass(), aClass -> new HashMap<>()).put(factory.getId(),factory.getClass()); } - } + } } - + recorder.configSessionFactory(factories, defaultProviders, Environment.isRebuild()); } /** *

Make the build time configuration available at runtime so that the server can run without having to specify some of * the properties again. - * + * *

This build step also adds a static call to {@link org.keycloak.cli.ShowConfigCommand#run(Map)} via the recorder * so that the configuration can be shown when requested. - * + * * @param recorder the recorder */ @Record(ExecutionTime.STATIC_INIT) @@ -217,7 +217,7 @@ class KeycloakProcessor { factories.put(spi, providers); } - + return factories; } @@ -237,8 +237,8 @@ class KeycloakProcessor { } private void checkProviders(Spi spi, - Map, Map> factoriesMap, - Map, String> defaultProviders) { + Map, Map> factoriesMap, + Map, String> defaultProviders) { String defaultProvider = Config.getProvider(spi.getName()); if (defaultProvider != null) { 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 f730f39397..79af4c7d88 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/configuration/KeycloakPropertiesConfigSource.java +++ b/quarkus/runtime/src/main/java/org/keycloak/configuration/KeycloakPropertiesConfigSource.java @@ -18,7 +18,6 @@ package org.keycloak.configuration; import java.io.Closeable; -import java.io.File; import java.io.FileNotFoundException; import java.io.IOError; import java.io.IOException; @@ -78,7 +77,7 @@ public abstract class KeycloakPropertiesConfigSource extends PropertiesConfigSou cl = KeycloakPropertiesConfigSource.class.getClassLoader(); } InputStream is; - String fileName = "META-INF" + File.separator + KEYCLOAK_PROPERTIES; + String fileName = "META-INF/" + KEYCLOAK_PROPERTIES; if (cl == null) { is = ClassLoader.getSystemResourceAsStream(fileName); } else {