[FLUSS-3553][build] Fix shaded Jackson classes leaking into uber-jars - #3884
[FLUSS-3553][build] Fix shaded Jackson classes leaking into uber-jars#3884Jackeyzhe wants to merge 1 commit into
Conversation
Exclude unshaded Multi-Release JAR (MRJ) entries from fluss-shaded-jackson via root pom.xml global shade filter. MRJ entries under META-INF/versions/*/com/fasterxml/jackson/ are not relocated by the shade plugin and leak into uber-jars, shadowing downstream apps' jackson-core (NoSuchMethodError: JsonToken._updateToken). 🤖 AI-assisted changes - reviewed by human developer Closes apache#3553
|
Gentle ping for review when anyone has a moment. All CI checks are green, and the fix is a single 11-line exclusion rule in the root pom.xml global shade filter. Quick recap: fluss-shaded-jackson ships unshaded Multi-Release JAR entries (META-INF/versions//com/fasterxml/) that the Maven Shade Plugin doesn't relocate. These leak into every uber-jar (fluss-client, fluss-flink-*) and can shadow downstream jackson-core 2.16+, causing NoSuchMethodError: JsonToken._updateToken at runtime. The fix adds one to the global * filter, which cascades to all modules via combine.children="append". Verified: 0 unshaded jackson entries in all 5 previously-affected uber-jars; fluss-common tests pass (267, 0 failures). Would appreciate it if @wuchong, @fresh-borzoni, or @Yohahaha could take a look when convenient. Happy to make adjustments if anything needs changing. Thanks! |
Summary
fluss-shaded-jacksoncontains unshaded Multi-Release JAR (MRJ) entries underMETA-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/(and siblingparser dirs). The Maven Shade Plugin only relocates base-path classes, not MRJ
entries. These leak into uber-jars (
fluss-client,fluss-flink-*) and canshadow downstream apps' jackson-core 2.16+, causing
NoSuchMethodError: JsonToken._updateToken.Root Cause
The shade plugin's relocation (
<relocation>) only transforms classes at theirbase path (
com/fasterxml/jackson/...). Multi-Release JAR entries stored underMETA-INF/versions/<java-version>/com/fasterxml/jackson/...are not relocatedand remain at their original package path. When these entries are packaged into
uber-jars, they can win the class-loading race against the consumer's own
jackson-core dependency.
Fix
Add
<exclude>META-INF/versions/**/com/fasterxml/**</exclude>to the rootpom.xmlglobal shade filter (<artifact>*</artifact>). This cascades to ALLmodules via
combine.children="append".The base
FastDoubleParserimplementation (at the relocated path) is sufficientfor all Java versions; the MRJ entries are only performance optimizations for
specific JDK versions.
Test Plan
contain unshaded jackson MRJ entries
./mvnw -pl fluss-common testpasses (267 tests, 0 failures)./mvnw spotless:checkpassesgit diff --checkcleanFiles Changed
pom.xml(+11 lines: 1 exclude rule in global shade filter)🤖 AI-assisted changes - reviewed by human developer
Closes #3553