Repository navigation
Add self-contained ai.chalk:chalk-java-shaded artifact (version-independent) - #200
Merged
Merged
Conversation
Relocates all third-party deps (protobuf, grpc, jackson, arrow, netty, ...) into ai.chalk.shaded.* so the artifact is immune to whatever versions a consumer or their runtime pins. Published as a separate coordinate with a dependency-free POM (deps are bundled, not declared), so consumers never pull a conflicting transitive. Fixes NoClassDefFoundError for clients pinned below protobuf 3.25 (e.g. 3.19 lacking MapFieldReflectionAccessor).
Bundled arrow/netty classes reference org.slf4j, which is not relocatable (logging facade must bind to the runtime). Declaring slf4j-api guarantees the class is present for any consumer, so the artifact is truly self-contained; Flink parent-first-loads org.slf4j so its own version still wins on-cluster. It is the only declared dep — everything else is bundled + relocated.
bqin01
approved these changes
Aug 6, 2026
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
Adds a second published coordinate,
ai.chalk:chalk-java-shaded— the same client + Flink connector aschalk-java, but with every third-party dependency relocated intoai.chalk.shaded.*. It's self-contained, so it works on any classpath regardless of what protobuf/grpc/jackson/arrow/netty versions a consumer (or their Flink/Spark runtime) pins.Why
A consumer pinned below our dependency versions hits linkage errors — e.g. a client on protobuf 3.19 gets:
MapFieldReflectionAccessoris a protobuf 3.25 class our generated stubs need, but the older protobuf on their classpath wins. We can't ask every consumer to change their pinned versions, and we can't shade protobuf into the mainchalk-java(its query API exposesai.chalk.protos.*types). So this ships a separate, fully-relocated artifact for exactly these conflict-prone environments (Flink connector use is the driver — its public API exposes zero third-party types).What changed
com.gradleup.shadowplugin + ashadowJarthat relocatescom.google(protobuf/guava/gson/flatbuffers/api-protos),io.grpc,io.netty,io.perfmark,com.fasterxml.jackson,org.apache.arrow,org.apache.commons,org.yaml.snakeyaml→ai.chalk.shaded.*, withmergeServiceFiles()so gRPC'sServiceLoaderproviders are rewritten too.chalk-java-shadedMavenPublicationwith a dependency-free POM (built manually, notfrom components.java) — critical: if the POM declared the deps, consumers would pull protobuf 3.25 transitively and re-hit the conflict.org.slf4j(excluded — logging facade binds to the runtime),javax.annotation,com.github.luben(zstd-jni — native JNI, relocation breaks the.sosymbol binding),org.apache.flink(compileOnly, provided by the cluster).Verification (local)
Ran the exact failing call from the crash with protobuf 3.19.0 on the classpath:
getGetTokenMethod()returnsai.chalk.shaded.grpc.MethodDescriptorMapFieldReflectionAccessorcrash (proves the test is real)Also verified:
com/google/protobuffully relocated (0 unshaded),ai.chalk.protos/ai.chalk.flinkuntouched, gRPCServiceLoaderfiles rewritten to shaded provider names, and the generatedchalk-java-shadedPOM is dependency-free with clean metadata.Consume
Needs a maintainer eye before release
I could verify the artifact + POM locally (
shadowJar,generatePomFile,publishToMavenLocal), but not the actual Central Portal upload of this second coordinate — that runs in CI with signing secrets. Please confirm on first release thatpublishAllPublicationsToMavenCentralpicks up theshadedpublication (vanniktech is single-artifact-oriented; the manual publication is signed bysignAllPublications()and should be bundled, but it's worth watching the first publish).