Skip to content

Commit

Permalink
KEYCLOAK-16066 KEYCLOAK-14255 Unable to build Keycloak distribution o…
Browse files Browse the repository at this point in the history
…n Windows due to io.quarkus.builder.BuildException failure

* file separator removed from KeycloakPropertiesConfigSource.java

Signed-off-by: Peter Zaoral <[email protected]>

fixing windows
  • Loading branch information
pedroigor committed Oct 30, 2020
1 parent 452bcd8 commit 18c67f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 73,13 @@ FeatureBuildItem getFeature() {

/**
* <p>Configures the persistence unit for Quarkus.
*
* <p>The main reason we have this build step is because we re-use the same persistence unit from {@code keycloak-model-jpa}
*
* <p>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
Expand All @@ -88,7 88,7 @@ FeatureBuildItem getFeature() {
@BuildStep
void configureHibernate(KeycloakRecorder recorder, HibernateOrmConfig config, List<PersistenceUnitDescriptorBuildItem> 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());
Expand All @@ -97,9 97,9 @@ void configureHibernate(KeycloakRecorder recorder, HibernateOrmConfig config, Li
/**
* <p>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.
*
*
* <p>User-defined providers are going to be loaded at startup</p>
*
*
* @param recorder
*/
@Record(ExecutionTime.RUNTIME_INIT)
Expand All @@ -119,19 119,19 @@ void configureProviders(KeycloakRecorder recorder) {
key -> new HashMap<>())
.computeIfAbsent(entry.getKey().getProviderClass(), aClass -> new HashMap<>()).put(factory.getId(),factory.getClass());
}
}
}
}

recorder.configSessionFactory(factories, defaultProviders, Environment.isRebuild());
}

/**
* <p>Make the build time configuration available at runtime so that the server can run without having to specify some of
* the properties again.
*
*
* <p>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)
Expand Down Expand Up @@ -217,7 217,7 @@ private Map<Spi, Map<Class<? extends Provider>, Map<String, ProviderFactory>>> l

factories.put(spi, providers);
}

return factories;
}

Expand All @@ -237,8 237,8 @@ private boolean isInternal(ProviderFactory<?> factory) {
}

private void checkProviders(Spi spi,
Map<Class<? extends Provider>, Map<String, ProviderFactory>> factoriesMap,
Map<Class<? extends Provider>, String> defaultProviders) {
Map<Class<? extends Provider>, Map<String, ProviderFactory>> factoriesMap,
Map<Class<? extends Provider>, String> defaultProviders) {
String defaultProvider = Config.getProvider(spi.getName());

if (defaultProvider != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -78,7 77,7 @@ private static InputStream openStream() {
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 {
Expand Down

0 comments on commit 18c67f5

Please sign in to comment.