The HTML Sanitizer is available from Maven Central
Including among your POMs <dependencies> this snippet of XML...
<dependency>
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
<artifactId>owasp-java-html-sanitizer</artifactId>
<version>20261110.1</version>
</dependency>...will make the sanitizer available.
The sanitizer JAR is self-contained: the java8-shim and java10-shim artifacts
are bundled inside it and do not need to be declared as separate dependencies,
including when using the JPMS module path.
In releases after 20260924.2, every class outside META-INF/versions/ is
Java 8 bytecode, so a Java 8 build that checks its dependencies with the Maven
Enforcer rule enforceBytecodeVersion and a maxJdkVersion of 1.8 accepts
the JAR without ignoreClasses. The shim for Java 10 and later is in
META-INF/versions/10/, which Java 8 never reads and which that rule allows
unless it is set to strict, which holds versioned classes to maxJdkVersion
too.
On the module path the JAR is an explicit module named
owasp.java.html.sanitizer that exports the org.owasp.html package:
module com.example.app {
requires owasp.java.html.sanitizer;
}Be sure to change the version to a range suitable to your project. There are no unstable releases in maven. Bigger numbers are more recent and the change log can shed light on the salient differences.
You should be able to build with the HTML sanitizer. You can read the javadoc, and if you have questions that aren't answered by these pages, you can ask in GitHub Discussions.
Happy sanitizing...