I clone the keycloak v18.0.2 and compile on Windows environment. Got the following error:
[ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:1.5.5:process-asciidoc (server-asciidoc-to-html) on project keycloak-guides: Execution server-asciidoc-to-html of goal org.asciidoctor:asciidoctor-maven-plugin:1.5.5:process-asciidoc failed: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: C:/dev/projects/also-keycloak/docs/guides/target/generated-guides/server/index.adoc: Failed to load AsciiDoc document - invalid byte sequence in UTF-8
This happened due to the UTF-8 is not the default encoding type in the Windows environment and en_US is not the system language.
I fixed it by adding -Dfile.encoding=UTF-8 as a MAVEN_OPTS parameter in System Environment Variable.
Hope this helps.