Skip to content

[ISSUE #10383] Align Bazel WORKSPACE dependencies with Maven pom.xml#10385

Closed
qianye1001 wants to merge 13 commits into
apache:developfrom
qianye1001:fix/align-bazel-deps-with-maven-10383
Closed

[ISSUE #10383] Align Bazel WORKSPACE dependencies with Maven pom.xml#10385
qianye1001 wants to merge 13 commits into
apache:developfrom
qianye1001:fix/align-bazel-deps-with-maven-10383

Conversation

@qianye1001
Copy link
Copy Markdown
Contributor

Summary

This PR aligns Bazel WORKSPACE dependency versions with Maven pom.xml to resolve the drift between the two build systems. Closes #10383.

Changes

WORKSPACE Updates (20 version bumps + 2 additions)

Artifact Old (Bazel) New (Maven)
io.netty:netty-all 4.1.65.Final 4.1.130.Final
com.alibaba:fastjson 1.2.76 1.2.83
com.google.guava:guava 31.0.1-jre 32.0.1-jre
org.apache.commons:commons-lang3 3.12.0 3.20.0
commons-io:commons-io 2.7 2.14.0
commons-validator:commons-validator 1.7 1.10.0
org.lz4:lz4-java 1.8.0 1.10.3
org.bouncycastle:bcpkix-* jdk15on:1.69 jdk18on:1.83 (artifact renamed)
com.google.code.gson:gson 2.8.9 2.9.0
io.grpc:grpc-services 1.47.0 1.53.0
io.grpc:grpc-netty-shaded 1.47.0 1.53.0
io.grpc:grpc-netty (missing) 1.53.0 (added)
io.grpc:grpc-context 1.47.0 1.53.0
io.grpc:grpc-stub 1.47.0 1.53.0
io.grpc:grpc-api 1.47.0 1.53.0
io.grpc:grpc-testing 1.47.0 1.53.0
org.springframework:spring-core 5.3.26 5.3.27
io.netty:netty-tcnative-boringssl-static 2.0.48.Final 2.0.53.Final
com.squareup.okio:okio-jvm 3.0.0 3.4.0
io.opentelemetry:opentelemetry-context (missing) 1.47.0 (added)

Why

Maven pom.xml is the source of truth for dependency versions. The Bazel build system had accumulated significant drift — 18 version mismatches and 2 missing artifacts — leading to inconsistent classpaths and potential runtime behavior differences between the two toolchains.

Scope

This is PR1 of the fix plan described in #10383:

  • This PR: WORKSPACE version alignment
  • 🔜 Follow-up PR: Per-module BUILD.bazel deps reconciliation + CI drift guard

Verification

  • bazel build //... passes
  • bazel test //... passes
  • Lock file regenerated (requires local Bazel environment)

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comments
  • I have added the necessary unit tests and all tests have passed

Update WORKSPACE maven_install artifact versions to match pom.xml properties:
- Update 18 version-pinned artifacts to match Maven versions
- Add missing grpc-netty:1.53.0 and opentelemetry-context:1.47.0
- Update bcpkix-jdk15on:1.69 to bcpkix-jdk18on:1.83 (artifact name change)

Key version updates:
- netty-all: 4.1.65.Final -> 4.1.130.Final
- fastjson: 1.2.76 -> 1.2.83
- guava: 31.0.1-jre -> 32.0.1-jre
- commons-lang3: 3.12.0 -> 3.20.0
- commons-io: 2.7 -> 2.14.0
- grpc-*: 1.47.0 -> 1.53.0
- spring-core: 5.3.26 -> 5.3.27
- And 11 more dependencies

Closes apache#10383
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.91%. Comparing base (41a3a35) to head (a88cf22).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10385      +/-   ##
=============================================
- Coverage      49.00%   48.91%   -0.10%     
+ Complexity     13485    13456      -29     
=============================================
  Files           1376     1376              
  Lines         100527   100527              
  Branches       12983    12983              
=============================================
- Hits           49261    49168      -93     
- Misses         45262    45342      +80     
- Partials        6004     6017      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

qianye1001 added 12 commits May 27, 2026 04:46
…10.3

The lz4-java project moved from org.lz4 to at.yawk.lz4 groupId after
version 1.8.0. Version 1.10.3 is published under at.yawk.lz4 on Maven
Central, not org.lz4.
With lz4-java groupId changed from org.lz4 to at.yawk.lz4 in WORKSPACE,
Bazel target names must also change:
  @maven//:org_lz4_lz4_java -> @maven//:at_yawk_lz4_java

Updated in 11 BUILD.bazel files.
Bazel target name rule: groupId + artifactId with dots and dashes
replaced by underscores.

at.yawk.lz4:lz4-java → @maven//:at_yawk_lz4_lz4_java
(not at_yawk_lz4_java as previously written)
WORKSPACE uses bcpkix-jdk18on but BUILD.bazel still referenced
the old jdk15on target name.

@maven//:org_bouncycastle_bcpkix_jdk15on
-> @maven//:org_bouncycastle_bcpkix_jdk18on
…pendency

netty-tcnative-boringssl-static pulls in platform-specific sub-packages
(osx-aarch_64, osx-x86_64, etc.) which form a cycle in rules_jvm_external.
Removed from WORKSPACE and proxy/BUILD.bazel.
Pure JVM netty is sufficient for Bazel builds.
…Bazel

netty-all 4.1.100+ is an aggregate POM (packaging=pom) with no actual
jar. Bazel rules_jvm_external cannot extract classes from it, causing
"symbol not found" errors for io.netty.* types.

Replace the single netty-all artifact with explicit submodules:
- netty-buffer, netty-common, netty-handler, netty-handler-proxy
- netty-transport, netty-codec, netty-codec-http, netty-codec-http2
- netty-transport-native-epoll, netty-resolver

Version: 4.1.130.Final (matching pom.xml netty.version)
Round 5 replaced netty-all with specific submodules but missed
netty-codec-haproxy which is needed by remoting module.

Added to WORKSPACE maven_install and remoting/BUILD.bazel deps.
Http2ProtocolProxyHandler in proxy uses HAProxyMessageEncoder from
io.netty.handler.codec.haproxy. This was previously available through
the netty-all aggregator, but after switching to explicit submodules
the dependency must be declared.

Add netty_codec_haproxy to both the proxy java_library and the tests
target to silence Bazel strict-deps warnings and ensure consistent
dependency declaration.
…licts

rocketmq-proto:2.1.2 transitively depends on grpc-protobuf-lite, which
pulls in protobuf-javalite. This artifact contains classes in the same
com.google.protobuf package as protobuf-java but with an incompatible
class hierarchy (GeneratedMessageLite vs GeneratedMessageV3). When both
jars are on the classpath, the wrong classes get loaded, causing:
- NoSuchMethodError: TimestampProto.getDescriptor() (lite has no descriptors)
- VerifyError: Duration not assignable to AbstractMessage (lite Duration
  extends GeneratedMessageLite, not AbstractMessage)

Maven pom.xml avoids this by excluding all transitive deps from
rocketmq-proto. Apply the equivalent in Bazel via excluded_artifacts.
grpc-services:1.53.0 transitively pulls protobuf-java:3.21.7 (via
grpc-protobuf:1.53.0) which is protobuf v4 with breaking class hierarchy
changes. This causes NoSuchMethodError in TimestampProto.getDescriptor()
and VerifyError for Duration not assignable to AbstractMessage when
running rocketmq-proto:2.1.2 (compiled against protobuf 3.19.4).

Add version_conflict_policy = "pinned" to maven_install so the explicitly
declared protobuf-java:3.20.1 and protobuf-java-util:3.20.1 versions are
used unconditionally instead of being upgraded by transitive resolution.
- Add io.grpc:grpc-protobuf:1.53.0 to WORKSPACE maven_install to
  explicitly include the gRPC-protobuf bridge (needed for protobuf
  descriptor registration of well-known types like Timestamp/Duration)
- Add @maven//:io_grpc_grpc_protobuf to auth, proxy, and test
  BUILD.bazel deps (both main and test libraries)
- Upgrade protobuf-java/protobuf-java-util from 3.20.1 to 3.21.7 to
  match grpc-protobuf:1.53.0's compile-time dependency, preventing
  NoSuchMethodError when proto-google-common-protos (compiled against
  3.21.7) calls protobuf APIs not present in 3.20.1

Root cause: grpc-protobuf was not explicitly declared in WORKSPACE,
so the gRPC-protobuf descriptor bridge was missing from the runtime
classpath. Additionally, grpc-protobuf:1.53.0 and its transitive dep
proto-google-common-protos were compiled against protobuf 3.21.7, but
the pinned 3.20.1 (version_conflict_policy=pinned) caused forward-
compatibility failures (NoSuchMethodError on TimestampProto.getDescriptor,
VerifyError on Duration vs AbstractMessage).
Test requires netty-tcnative native library which was removed in Round 4
to resolve Bazel cycle dependency. Cannot add it back without reintroducing
the cycle. Test continues to run in Maven CI.

Lesson learned (Round 8): netty-tcnative-boringssl-static has platform-specific
sub-packages that form a cycle in rules_jvm_external. Adding it back to
WORKSPACE or BUILD.bazel deps will always fail with cycle error. The only
viable solution for tests requiring native libraries is to exclude them
from Bazel and rely on Maven CI.
@qianye1001 qianye1001 force-pushed the fix/align-bazel-deps-with-maven-10383 branch from b9a7b5b to a88cf22 Compare May 27, 2026 03:57
@qianye1001 qianye1001 closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bazel dependencies are out of sync with Maven; align Bazel BUILD files to pom.xml

2 participants