From 3f1553c6cb75b8f0a6924ced9ca077546cfc2e8f Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Wed, 5 Jul 2023 17:52:02 +0200 Subject: [PATCH] Referencing information in pom.xml for the list of tested databases Closes: #21349 --- docs/guides/server/db.adoc | 22 ++++++++++--------- .../keycloak/guides/maven/GuideBuilder.java | 8 +++++-- .../org/keycloak/guides/maven/GuideMojo.java | 6 ++++- pom.xml | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docs/guides/server/db.adoc b/docs/guides/server/db.adoc index 657a783015..8e82fc61a3 100644 --- a/docs/guides/server/db.adoc +++ b/docs/guides/server/db.adoc @@ -15,13 +15,13 @@ This {section} explains how to configure the Keycloak server to store data in a The server has built-in support for different databases. You can query the available databases by viewing the expected values for the `db` configuration option. The following table lists the supported databases and their tested versions. |=== -|Database | Tested Version +|Database | Option value | Tested Version -|mariadb| 10 -|mssql| 2016 -|mysql| 8 -|oracle| 12c -|postgres| 15 +|MariaDB Server | `mariadb` | ${properties["mariadb.version"]} +|Microsoft SQL Server | `mssql` | ${properties["mssql.version"]?replace("-latest","")} +|MySQL | `mysql` | ${properties["mysql.version"]} +|Oracle Database | `oracle` | ${properties["oracledb.version"]} +|PostgreSQL | `postgres` | ${properties["postgresql.version"]} |=== By default, the server uses the `dev-file` database. This is the default database that the server will use to persist data and @@ -131,16 +131,18 @@ Unicode is supported for a PostgreSQL database when the database character set i . Check the default character set for a PostgreSQL cluster by entering the following SQL command. + -``` +[source] +---- show server_encoding; -``` +---- . If the default character set is not UTF 8, create the database with the UTF8 as the default character set using a command such as: + -``` +[source] +---- create database keycloak with encoding 'UTF8'; -``` +---- == Changing database locking timeout in a cluster configuration diff --git a/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideBuilder.java b/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideBuilder.java index fa11e7b2c9..e124a21812 100644 --- a/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideBuilder.java +++ b/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideBuilder.java @@ -2,6 +2,7 @@ package org.keycloak.guides.maven; import freemarker.template.TemplateException; import org.apache.maven.plugin.logging.Log; +import org.apache.maven.project.MavenProject; import org.keycloak.common.Version; import java.io.File; @@ -16,7 +17,7 @@ public class GuideBuilder { private final File targetDir; private final Log log; - public GuideBuilder(File srcDir, File targetDir, Log log) throws IOException { + public GuideBuilder(File srcDir, File targetDir, Log log, MavenProject project) throws IOException { this.srcDir = srcDir; this.targetDir = targetDir; this.log = log; @@ -24,13 +25,16 @@ public class GuideBuilder { Map globalAttributes = new HashMap<>(); globalAttributes.put("ctx", new Context(srcDir)); globalAttributes.put("version", Version.VERSION); + globalAttributes.put("properties", project.getProperties()); this.freeMarker = new FreeMarker(srcDir.getParentFile(), globalAttributes); } public void build() throws TemplateException, IOException { if (!srcDir.isDirectory()) { - srcDir.mkdir(); + if (!srcDir.mkdir()) { + throw new RuntimeException("Can't create folder " + srcDir); + } } for (String t : srcDir.list((dir, name) -> name.endsWith(".adoc"))) { diff --git a/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideMojo.java b/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideMojo.java index d6283a9ad8..bf5e5c8870 100644 --- a/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideMojo.java +++ b/docs/maven-plugin/src/main/java/org/keycloak/guides/maven/GuideMojo.java @@ -6,6 +6,7 @@ import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils; import java.io.File; @@ -19,6 +20,9 @@ public class GuideMojo extends AbstractMojo { @Parameter(property = "project.build.directory") private String targetDir; + @Parameter(defaultValue = "${project}", readonly = true, required = true) + private MavenProject project; + @Override public void execute() throws MojoFailureException { try { @@ -42,7 +46,7 @@ public class GuideMojo extends AbstractMojo { log.info("Guide dir: " + srcDir.getAbsolutePath()); log.info("Target dir: " + targetDir.getAbsolutePath()); - GuideBuilder g = new GuideBuilder(srcDir, targetDir, log); + GuideBuilder g = new GuideBuilder(srcDir, targetDir, log, project); g.build(); } } diff --git a/pom.xml b/pom.xml index 2985d1a838..3ac6c85a7e 100644 --- a/pom.xml +++ b/pom.xml @@ -157,7 +157,7 @@ 4.1.2 4.5.1 - + 8.0 8.0.30 15