From b7a869e5131e23262e85e6fc8f7ea5ca1f3d0faa Mon Sep 17 00:00:00 2001 From: Alessandro Ruzzon Date: Thu, 23 Apr 2026 21:55:31 +0200 Subject: [PATCH] Bundle java8-shim and java10-shim into the main JAR to fix JPMS split-package error --- .gitignore | 2 ++ change_log.md | 5 ++++ docs/maven.md | 6 ++++- owasp-java-html-sanitizer/pom.xml | 44 +++++++++++++++++++++++++++++++ pom.xml | 5 ++++ 5 files changed, 61 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8a3318b3..849f6e14 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ target .settings .idea out +PLAN.md +dependency-reduced-pom.xml diff --git a/change_log.md b/change_log.md index 8768a95c..676e7d34 100644 --- a/change_log.md +++ b/change_log.md @@ -1,6 +1,11 @@ # OWASP Java HTML Sanitizer Change Log Most recent at top. + * Next release + * Fix: `java8-shim` and `java10-shim` are now bundled inside the main JAR, + resolving the JPMS split-package error on the module path. Consumers no + longer need to declare the shim artifacts as direct dependencies. Both + shim JARs remain published on Maven Central for backwards compatibility. * Release 20240325.1 * Remove dependency on Guava * Raise minimum supported JVM release to 8 diff --git a/docs/maven.md b/docs/maven.md index afc82bb6..a0d9d74e 100644 --- a/docs/maven.md +++ b/docs/maven.md @@ -9,12 +9,16 @@ Including among your POMs `` this snippet of XML... com.googlecode.owasp-java-html-sanitizer owasp-java-html-sanitizer - 20180219.1 + 20240325.1 ``` ...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. + Be sure to change the [version](https://cwiki.apache.org/confluence/display/MAVENOLD/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges) to a range suitable to your project. There are no unstable releases diff --git a/owasp-java-html-sanitizer/pom.xml b/owasp-java-html-sanitizer/pom.xml index c4597c03..8f264395 100644 --- a/owasp-java-html-sanitizer/pom.xml +++ b/owasp-java-html-sanitizer/pom.xml @@ -67,6 +67,10 @@ org.owasp.html + + owasp.java.html.sanitizer @@ -86,6 +90,44 @@ + + org.apache.maven.plugins + maven-shade-plugin + + + package + shade + + + + + com.googlecode.owasp-java-html-sanitizer:java8-shim + com.googlecode.owasp-java-html-sanitizer:java10-shim + + + + + *:* + + + META-INF/maven/com.googlecode.owasp-java-html-sanitizer/java*/** + + + + + false + + true + + + + @@ -93,10 +135,12 @@ com.googlecode.owasp-java-html-sanitizer java8-shim + true com.googlecode.owasp-java-html-sanitizer java10-shim + true commons-codec diff --git a/pom.xml b/pom.xml index 6d9896d4..12f20876 100644 --- a/pom.xml +++ b/pom.xml @@ -196,6 +196,11 @@ application while protecting against XSS. maven-verifier-plugin 1.1 + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 +