[KEYCLOAK-14255] - Changes to maven definition and initial support for dev mode
This commit is contained in:
parent
4cd5ace800
commit
967449f5c6
6 changed files with 106 additions and 82 deletions
|
@ -1,17 +1,56 @@
|
|||
# Keycloak Quarkus Distribution
|
||||
# Keycloak on Quarkus
|
||||
|
||||
Keycloak on Quarkus is a work in progress.
|
||||
The module holds the codebase to run Keycloak on top of [Quarkus](https://quarkus.io/):
|
||||
|
||||
├── deployment
|
||||
│ ├── Build-time codebase with all the necessary steps to build and configure the server
|
||||
│
|
||||
├── runtime
|
||||
│ ├── Runtime codebase with all the runtime code
|
||||
│
|
||||
└── server
|
||||
├── The server itself, only responsible for generating the server artifacts
|
||||
|
||||
|
||||
## Activating the Module
|
||||
|
||||
The module isn't enabled by default. To enable it please activate the `quarkus` profile.
|
||||
|
||||
## Building
|
||||
|
||||
To build the module and produce the artifacts to run a server:
|
||||
|
||||
mvn -f ../pom.xml clean install -DskipTestsuite -DskipExamples -DskipTests -Pquarkus
|
||||
|
||||
### Building the Distribution
|
||||
|
||||
To build the module as well as the distribution packages:
|
||||
|
||||
mvn -f ../pom.xml clean install -DskipTestsuite -DskipExamples -DskipTests -Pquarkus,distribution
|
||||
|
||||
The distribution packages (ZIP and TAR) should be available at [../distribution/server-x](../distribution/server-x/target).
|
||||
|
||||
## Running
|
||||
|
||||
java -jar server/target/keycloak-runner.jar
|
||||
java -jar server/target/lib/quarkus-run.jar
|
||||
|
||||
## Running in dev mode
|
||||
## Contributing
|
||||
|
||||
### Development Mode
|
||||
|
||||
To run the server in development mode:
|
||||
|
||||
cd server
|
||||
mvn compile quarkus:dev
|
||||
|
||||
You should be able to attach your debugger to port `5005`.
|
||||
|
||||
Changes to files such as `server/src/main/resources` or `server/src/main/resources/META-INF/keycloak.properties` should
|
||||
be recognized automatically when running in development mode.
|
||||
|
||||
However, considering that there is no real code in the `server` module (but from `runtime` and its dependencies), changes you make to
|
||||
dependencies (e.g: services, model, etc) won't be reflected into the running server. However, you can still leverage the
|
||||
hot reload capabilities from your IDE to make changes at runtime.
|
||||
|
||||
NOTE: We need to improve DevX and figure out why changes to dependencies are not being recognized when running tests or running
|
||||
Quarkus Dev Mode.
|
|
@ -14,21 +14,6 @@
|
|||
<artifactId>keycloak-quarkus-server-deployment</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-core-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-arc-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx-web-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-quarkus-server</artifactId>
|
||||
|
@ -36,48 +21,51 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-resteasy-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<artifactId>quarkus-core-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-resteasy-jackson-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-hibernate-orm-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-h2-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-postgresql-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-mariadb-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<artifactId>quarkus-arc-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx-web-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-resteasy-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-resteasy-jackson-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-hibernate-orm-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-h2-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-postgresql-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-mariadb-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx-web-deployment</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-bootstrap-core</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-junit5-internal</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -146,7 +134,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import io.quarkus.deployment.IsDevelopment;
|
||||
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
|
||||
import io.quarkus.hibernate.orm.deployment.HibernateOrmConfig;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor;
|
||||
|
@ -80,6 +82,11 @@ class KeycloakProcessor {
|
|||
routes.produce(new FilterBuildItem(new QuarkusRequestFilter(), FilterBuildItem.AUTHORIZATION - 10));
|
||||
}
|
||||
|
||||
@BuildStep(onlyIf = IsDevelopment.class)
|
||||
void configureDevMode(BuildProducer<HotDeploymentWatchedFileBuildItem> hotFiles) {
|
||||
hotFiles.produce(new HotDeploymentWatchedFileBuildItem("META-INF/keycloak.properties"));
|
||||
}
|
||||
|
||||
private Map<Spi, Set<Class<? extends ProviderFactory>>> loadFactories() {
|
||||
ProviderManager pm = new ProviderManager(
|
||||
KeycloakDeploymentInfo.create().services(), new BuildClassLoader(),
|
||||
|
|
|
@ -37,9 +37,7 @@
|
|||
<jackson.databind.version>${jackson.version}</jackson.databind.version>
|
||||
<hibernate.version>5.4.18.Final</hibernate.version>
|
||||
<snakeyaml.version>1.20</snakeyaml.version>
|
||||
|
||||
<surefire-plugin.version>2.22.0</surefire-plugin.version>
|
||||
|
||||
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
|
||||
<wildfly.common.format.version>1.5.0.Final-format-001</wildfly.common.format.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -51,21 +49,11 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-bom-deployment</artifactId>
|
||||
<artifactId>quarkus-bom</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-quarkus-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-quarkus-server-deployment</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
|
|
|
@ -15,6 +15,18 @@
|
|||
|
||||
<dependencies>
|
||||
<!-- Quarkus -->
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx-http</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-resteasy</artifactId>
|
||||
|
|
|
@ -14,35 +14,26 @@
|
|||
<name>Keycloak Quarkus Server App</name>
|
||||
<artifactId>keycloak-quarkus-server-app</artifactId>
|
||||
|
||||
<properties>
|
||||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
|
||||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
|
||||
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${quarkus.platform.group-id}</groupId>
|
||||
<artifactId>${quarkus.platform.artifact-id}</artifactId>
|
||||
<version>${quarkus.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-quarkus-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency should not be here but due to the structure of the modules we need to make sure it is built
|
||||
before this module -->
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-quarkus-server-deployment</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
Loading…
Reference in a new issue