From 6900f4e6473cc1d0f574979d3ee1c560dfd367b8 Mon Sep 17 00:00:00 2001
From: Hugo Renard <hugo.renard@protonmail.com>
Date: Tue, 17 May 2022 14:48:45 +0200
Subject: [PATCH] (feat) suppor kc 18 on quarkus + move to gradle

---
 .gitignore         |   5 +-
 .gitlab-ci.yml     |   7 +-
 build.gradle       |  40 ++++++++++
 docker-compose.yml |  21 +++--
 pom.xml            | 188 ---------------------------------------------
 5 files changed, 57 insertions(+), 204 deletions(-)
 create mode 100644 build.gradle
 delete mode 100644 pom.xml

diff --git a/.gitignore b/.gitignore
index 40d9aca..b974351 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-/target
-/.idea
\ No newline at end of file
+/build
+/.idea
+/.gradle
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 010a802..9247aa6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,10 +1,11 @@
 package:
   image:
-    name: maven:3-openjdk-11
+    name: gradle:jdk11
   script:
-    - mvn clean install
+    - gradle jar shadowjar
   artifacts:
     paths:
-      - target/keycloak-scim-1.0-SNAPSHOT-jar-with-dependencies.jar
+      - build/libs/keycloak-scim-1.0-SNAPSHOT.jar
+      - build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar
   only:
     - main
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..92af4ee
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,40 @@
+plugins {
+    id 'java'
+    id 'com.github.johnrengelman.shadow' version '7.1.2'
+}
+
+group = 'sh.libre.scim'
+version = '1.0-SNAPSHOT'
+description = 'keycloak-scim'
+
+java.sourceCompatibility = JavaVersion.VERSION_11
+
+repositories {
+    mavenLocal()
+    mavenCentral()
+}
+
+dependencies {
+    compileOnly 'org.keycloak:keycloak-core:18.0.0'
+    compileOnly 'org.keycloak:keycloak-server-spi:18.0.0'
+    compileOnly 'org.keycloak:keycloak-server-spi-private:18.0.0'
+    compileOnly 'org.keycloak:keycloak-services:18.0.0'
+    compileOnly 'org.keycloak:keycloak-model-jpa:18.0.0'
+    implementation 'io.github.resilience4j:resilience4j-retry:1.7.0'
+    implementation('com.unboundid.product.scim2:scim2-sdk-client:2.3.7') {
+        transitive false
+    }
+    implementation('com.unboundid.product.scim2:scim2-sdk-common:2.3.7') {
+        transitive false
+    }
+    implementation('org.wildfly.client:wildfly-client-config:1.0.1.Final') {
+        transitive false
+    }
+    implementation('org.jboss.resteasy:resteasy-client:4.7.6.Final') {
+        transitive false
+    }
+    implementation('org.jboss.resteasy:resteasy-client-api:4.7.6.Final') {
+        transitive false
+    }
+
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index 3c09023..d18aa1e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,19 +11,18 @@ services:
     ports:
       - 5432:5432
   keycloak:
-    image: quay.io/keycloak/keycloak:16.1.1
+    image: quay.io/keycloak/keycloak:18.0.0
+    build: .
+    command: start-dev
     volumes:
-      - ./target/keycloak-scim-1.0-SNAPSHOT-jar-with-dependencies.jar:/opt/jboss/keycloak/standalone/deployments/keycloak-scim-1.0-SNAPSHOT.jar
+      - ./build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar:/opt/keycloak/providers/keycloak-scim-1.0-SNAPSHOT-all.jar
     environment:
-      DB_VENDOR: POSTGRES
-      DB_ADDR: postgres
-      DB_DATABASE: keycloak
-      DB_USER: keycloak
-      DB_SCHEMA: public
-      DB_PASSWORD: keycloak
-      KEYCLOAK_USER: admin
-      KEYCLOAK_PASSWORD: admin
-      KEYCLOAK_LOGLEVEL: DEBUG
+      KC_DB: postgres
+      KC_DB_URL_HOST: postgres
+      KC_DB_USERNAME: keycloak
+      KC_DB_PASSWORD: keycloak
+      KEYCLOAK_ADMIN: admin
+      KEYCLOAK_ADMIN_PASSWORD: admin
     ports:
       - 127.0.0.1:8080:8080
     depends_on:
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 866b05a..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,188 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>sh.libre.scim</groupId>
-  <artifactId>keycloak-scim</artifactId>
-  <version>1.0-SNAPSHOT</version>
-
-  <name>keycloak-scim</name>
-  <!-- FIXME change it to the project's website -->
-  <url>http://www.example.com</url>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <maven.compiler.source>11</maven.compiler.source>
-    <maven.compiler.target>11</maven.compiler.target>
-    <keycloak.version>16.1.0</keycloak.version>
-    <kotlin.version>1.6.10</kotlin.version>
-    <jackson.version>2.12.1</jackson.version>
-    <resteasy.version>3.15.1.Final</resteasy.version>
-    <resilience4jVersion>1.7.0</resilience4jVersion>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.keycloak</groupId>
-      <artifactId>keycloak-core</artifactId>
-      <scope>provided</scope>
-      <version>${keycloak.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.keycloak</groupId>
-      <artifactId>keycloak-server-spi</artifactId>
-      <scope>provided</scope>
-      <version>${keycloak.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.keycloak</groupId>
-      <artifactId>keycloak-server-spi-private</artifactId>
-      <scope>provided</scope>
-      <version>${keycloak.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.keycloak</groupId>
-      <artifactId>keycloak-services</artifactId>
-      <scope>provided</scope>
-      <version>${keycloak.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.keycloak</groupId>
-      <artifactId>keycloak-model-jpa</artifactId>
-      <scope>provided</scope>
-      <version>${keycloak.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>com.unboundid.product.scim2</groupId>
-      <artifactId>scim2-sdk-client</artifactId>
-      <version>2.3.7</version>
-    </dependency>
-    <dependency>
-      <groupId>javax.ws.rs</groupId>
-      <artifactId>javax.ws.rs-api</artifactId>
-      <version>2.1.1</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.xml.bind</groupId>
-      <artifactId>jaxb-api</artifactId>
-      <version>2.3.1</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-core</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-annotations</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.module</groupId>
-      <artifactId>jackson-module-jaxb-annotations</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.datatype</groupId>
-      <artifactId>jackson-datatype-jdk8</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.jaxrs</groupId>
-      <artifactId>jackson-jaxrs-json-provider</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.jaxrs</groupId>
-      <artifactId>jackson-jaxrs-base</artifactId>
-      <version>${jackson.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.resteasy</groupId>
-      <artifactId>resteasy-jaxrs</artifactId>
-      <version>${resteasy.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.resteasy</groupId>
-      <artifactId>resteasy-multipart-provider</artifactId>
-      <version>${resteasy.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.resteasy</groupId>
-      <artifactId>resteasy-jackson2-provider</artifactId>
-      <version>${resteasy.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.resteasy</groupId>
-      <artifactId>resteasy-jaxb-provider</artifactId>
-      <version>${resteasy.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.resteasy</groupId>
-      <artifactId>resteasy-client</artifactId>
-      <version>${resteasy.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.github.resilience4j</groupId>
-      <artifactId>resilience4j-retry</artifactId>
-      <version>${resilience4jVersion}</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.wildfly.plugins</groupId>
-        <artifactId>wildfly-maven-plugin</artifactId>
-        <version>2.1.0</version>
-        <configuration>
-          <skip>false</skip>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <version>2.6</version>
-        <executions>
-          <execution>
-            <id>make-assembly</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-            <configuration>
-              <archive>
-                <manifest>
-                  <mainClass>${main.class}</mainClass>
-                </manifest>
-              </archive>
-              <descriptorRefs>
-                <descriptorRef>jar-with-dependencies</descriptorRef>
-              </descriptorRefs>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
-- 
GitLab