Skip to content

Commit 051b5d7

Browse files
committed
Make plugin buildable and usable for Keycloak 22+
Change-Id: I4d54f52c9d77633511db8a7bccdb083d0b63518a
1 parent 4032a6b commit 051b5d7

File tree

7 files changed

+56
-38
lines changed

7 files changed

+56
-38
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
target/
1+
target/
2+
testing/mosquitto/log/mosquitto.log

.zuul.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22
- project:
33
check:
44
jobs:
5-
- keycloak-extensions-maven-build
6-
- keycloak-extensions-test-deploy-21.0
5+
- keycloak-extensions-maven-build:
6+
vars:
7+
jdk_version: 17
8+
- keycloak-extensions-test-deploy-22.0:
9+
vars:
10+
jdk_version: 17
711
- keycloak-extensions-test-deploy-latest:
812
voting: false
913
gate:
1014
jobs:
11-
- keycloak-extensions-maven-build
12-
- keycloak-extensions-test-deploy-21.0
15+
- keycloak-extensions-maven-build:
16+
vars:
17+
jdk_version: 17
18+
- keycloak-extensions-test-deploy-22.0:
19+
vars:
20+
jdk_version: 17
1321
- keycloak-extensions-test-deploy-latest:
1422
voting: false

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22

33
A Keycloak SPI that publishes events to a MQTT broker.
44

5-
This SPI has been deployed successfully on a containerized Keycloak 19.0.2
6-
and on a Keycloak 19.0 server on a kubernetes cluster. It should therefore
7-
work properly on any version of Keycloak above 19.0.2.
5+
This SPI has been deployed successfully on a containerized Keycloak 22.0.
6+
It should therefore work properly on any version of Keycloak above 22.0.
87

98
# Build
109

1110
```
1211
mvn clean install
1312
```
1413

14+
To build the SPI for use with a version of Keycloak prior to 22.X, you need to use openjdk 11 and patch pom.xml to target java 11:
15+
16+
```
17+
<source>11</source>
18+
<target>11</target>
19+
```
20+
1521
# Deploy
1622

1723
## Keycloak on Wildfly

demo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ echo "Done."
1212
echo
1313

1414
echo "Building keycloak with event listener ..."
15-
podman build -t test_kc_event_listener --build-arg KEYCLOAK_VERSION=${KEYCLOAK_VERSION:-21.0} -f testing/Dockerfile .
15+
podman build -t test_kc_event_listener --build-arg KEYCLOAK_VERSION=${KEYCLOAK_VERSION:-22.0} -f testing/Dockerfile .
1616
echo "Done."
1717
echo
1818

pom.xml

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
~ limitations under the License.
1616
-->
1717

18-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
18+
<project xmlns="http://maven.apache.org/POM/4.0.0"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2021
<groupId>org.softwarefactory.keycloak.providers.events.mqtt</groupId>
21-
<version>19.0.2</version>
22+
<version>22.0.0</version>
2223

2324
<name>Keycloak: Event Publisher to MQTT</name>
24-
<description/>
25+
<description />
2526
<modelVersion>4.0.0</modelVersion>
2627

2728
<artifactId>event-listener-mqtt</artifactId>
@@ -67,6 +68,7 @@
6768
<groupId>org.keycloak</groupId>
6869
<artifactId>keycloak-core</artifactId>
6970
<version>${version.keycloak}</version>
71+
<scope>provided</scope>
7072
</dependency>
7173
<dependency>
7274
<groupId>org.keycloak</groupId>
@@ -101,8 +103,8 @@
101103
<artifactId>maven-compiler-plugin</artifactId>
102104
<version>${version.compiler.maven.plugin}</version>
103105
<configuration>
104-
<source>11</source>
105-
<target>11</target>
106+
<source>17</source>
107+
<target>17</target>
106108
</configuration>
107109
</plugin>
108110
<plugin>
@@ -117,27 +119,27 @@
117119
</configuration>
118120
</plugin>
119121
<!-- Maven Assembly Plugin -->
120-
<plugin>
121-
<groupId>org.apache.maven.plugins</groupId>
122-
<artifactId>maven-assembly-plugin</artifactId>
123-
<version>2.4.1</version>
124-
<configuration>
125-
<!-- get all project dependencies -->
126-
<descriptorRefs>
127-
<descriptorRef>jar-with-dependencies</descriptorRef>
128-
</descriptorRefs>
129-
</configuration>
130-
<executions>
131-
<execution>
132-
<id>make-assembly</id>
133-
<!-- bind to the packaging phase -->
134-
<phase>package</phase>
135-
<goals>
136-
<goal>single</goal>
137-
</goals>
138-
</execution>
139-
</executions>
140-
</plugin>
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-assembly-plugin</artifactId>
125+
<version>2.4.1</version>
126+
<configuration>
127+
<!-- get all project dependencies -->
128+
<descriptorRefs>
129+
<descriptorRef>jar-with-dependencies</descriptorRef>
130+
</descriptorRefs>
131+
</configuration>
132+
<executions>
133+
<execution>
134+
<id>make-assembly</id>
135+
<!-- bind to the packaging phase -->
136+
<phase>package</phase>
137+
<goals>
138+
<goal>single</goal>
139+
</goals>
140+
</execution>
141+
</executions>
142+
</plugin>
141143
<plugin>
142144
<artifactId>maven-enforcer-plugin</artifactId>
143145
<version>3.2.1</version>
@@ -150,4 +152,4 @@
150152
</plugin>
151153
</plugins>
152154
</build>
153-
</project>
155+
</project>

testing/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG KEYCLOAK_VERSION=21.0
1+
ARG KEYCLOAK_VERSION=22.0
22

33
FROM quay.io/keycloak/keycloak:$KEYCLOAK_VERSION as builder
44

testing/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
- DB_VENDOR=h2
2222
- KC_HTTP_PORT=8082
2323
- KC_HEALTH_ENABLED=true
24+
- KC_LOG_LEVEL=debug
2425
command:
2526
- "start-dev"
2627
- "--spi-events-listener-mqtt-server-uri=\"tcp://mosquitto:1883\""

0 commit comments

Comments
 (0)