Skip to content

Exclude build-only dependencies from beam-sdks-java-harness jar - #167

Merged
yananhao12 merged 2 commits into
linkedin:li_trunkfrom
yehaolan:fix-harness-jar-exclude-build-deps
May 6, 2026
Merged

yananhao12 merged 2 commits into
linkedin:li_trunkfrom
yehaolan:fix-harness-jar-exclude-build-deps

Conversation

@yehaolan

@yehaolan yehaolan commented May 5, 2026

Copy link
Copy Markdown

Problem

beam-sdks-java-harness was bundling build/compile-time only dependencies into its uber jar with no shade relocation, leaking them onto consumer MP classpaths:

  • junit / junit.framework / junit.runner — test framework (6+17+3+2 classes)
  • org.hamcrest — test assertion library (109 classes)
  • org.checkerframework — compile-time annotation only, no runtime behavior (358 classes)
  • io.github.classgraph / nonapi.io — not used in harness main source (122+120 classes)

None of these are used in sdks/java/harness/src/main/java/ at runtime (verified via grep). org.checkerframework.@Nullable is used as a compile-time annotation only and is not needed at runtime.

Fix

Explicitly exclude these build-only dependencies from the shadowClosure dependencies block in sdks/java/harness/build.gradle so they are not bundled into the fat jar.

Verification

Before fix:
jar tf beam-sdks-java-harness-2.45.55-SNAPSHOT.jar | grep -E '^(junit|org/hamcrest|org/checkerframework|io/github/classgraph|nonapi/io)/'
returns 700+ classes

After fix:
jar tf beam-sdks-java-harness-2.45.56-SNAPSHOT.jar | grep -E '^(junit|org/hamcrest|org/checkerframework|io/github/classgraph|nonapi/io)/'
returns nothing

Changes

  • sdks/java/harness/build.gradle: exclude junit, hamcrest, checkerframework, classgraph from shadow jar bundling
  • buildSrc/.../BeamModulePlugin.groovy: bump version to 2.45.56
  • gradle.properties: bump version to 2.45.56

@yananhao12
yananhao12 merged commit 5918cda into linkedin:li_trunk May 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants