[FLUSS-3553][build] Fix shaded Jackson classes leaking into uber-jars - #3884
Open
Jackeyzhe wants to merge 1 commit into
Open
[FLUSS-3553][build] Fix shaded Jackson classes leaking into uber-jars#3884Jackeyzhe wants to merge 1 commit into
Jackeyzhe 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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