[improve][build] Require Java 21 for servers while preserving Java 17 client compatibility - #26769
Merged
Merged
Conversation
… client compatibility Keep client and Functions/IO API dependency closures on Java 17, verify bytecode and published JVM metadata, and run consumer compatibility tests with a Java 17 Gradle toolchain. Assisted-by: Codex
lhotari
requested review from
Technoboy-,
dao-jun,
david-streamlio,
merlimat and
nodece
September 29, 2026 21:02
Move shared websocket DTOs and their error enum to pulsar-common without changing packages. Keep client tools, CLI utilities and custom-command examples on Java 17, use the compatible JLine bundle and verify the CLI on a Java 17 toolchain. Assisted-by: Codex
Assisted-by: Codex
Retain the jdk11 bundle for Java 17 client tools and update distribution license filenames. Assisted-by: Codex
Add pulsarJavaVersion and pulsarClientJavaVersion release targets and a PULSAR_MIN_JAVA_VERSION launcher override. Keep Java 21/17 defaults, follow configured targets in compatibility checks and toolchains, and remove version numbers from compatibility task and test names. Assisted-by: Codex
Pass pulsarJavaVersion to Alpine and Wolfi Docker builds and persist it as PULSAR_MIN_JAVA_VERSION in the final images. Assisted-by: Codex
merlimat
approved these changes
Sep 29, 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.
Motivation
Pulsar 5 server components should default to Java 21, preparing for features such as virtual threads, while client libraries remain usable on Java 17, as discussed on the dev mailing list. Users must also be able to compile Functions and IO implementations against the public interfaces with Java 17, even though Pulsar's Functions runtime requires Java 21.
Modifications
pulsarJavaVersion=21andpulsarClientJavaVersion=17Gradle properties controlling release targets, JVM metadata, and client compatibility verification. Consumer tests select the configured client JDK through Gradle toolchains.PULSAR_MIN_JAVA_VERSIONenvironment override. A custom-PpulsarJavaVersion=17build can usePULSAR_MIN_JAVA_VERSION=17while source/dependency compatibility permits it; Gradle still requires a supported build JDK. No Java 17 server CI job is added.pulsarJavaVersioninto both Alpine and Wolfi Docker builds and persist it as the image environment variablePULSAR_MIN_JAVA_VERSION.org.apache.pulsar.websocket.datapackage topulsar-common, and moveWebSocketErrorinto that package alongside the DTOs. Update websocket handler imports and remove the now-empty parent package from common. Client tools no longer depends on the websocket server module.jdk11classifier for client tools to exclude the optional Java 22 FFM provider; update binary license filenames.--release 17and executed with Gradle's Java 17 toolchain launcher, plus CI setup and documentation.Verifying this change
Passed locally on Gradle 9.8.0:
./gradlew help assemble sanityCheck :tests:pulsar-client-java-compatibility:test generateMetadataFileForMavenPublication -PtestRetryCount=0 --configuration-cache --warning-mode all./gradlew -p build-logic :conventions:test --tests VerifyJavaCompatibilityTestsanityCheckincludes Spotless, Checkstyle, and main/test compilation.data,sanityCheck, the Java 17 consumer tests, andAbstractWebSocketHandlerTestpassed with retries disabled.assembleandsanityCheckwith-PpulsarJavaVersion=17(broker bytecode/metadata verified as Java 17); consumer tests and bytecode verification with-PpulsarClientJavaVersion=21; launcher minimum-version checks for defaults and overrides. No Java 17 server CI job is added.PULSAR_MIN_JAVA_VERSION=21by default and17with the project override;quickCheckpassed. Docker images were not built locally.assemble sanityCheck checkBinaryLicenseand all three Java 17 consumer tests passed. Focused V5 shaded/all client classpath tests passed on Java 17; the complete CI shade-test task graph also resolves on Java 17 (--dry-run).Full broker and cross-JVM interoperability tests were not run. The bytecode checker does not prove all third-party JDK API or reflective compatibility. Gradle reports deprecations for
Configuration.setVisibleand publication dependencies on unpublished projects; these are outside this change.Does this pull request potentially affect one of the following parts:
Server components and Functions runtime implementations now require Java 21 or later. Client libraries, client CLI tools, and Functions/IO public interfaces retain Java 17 compatibility. JLine is upgraded to 4.4.6 using its Java 11-compatible bundle classifier. JLine 4.4 reduces the default ambiguous-key timeout from 1000 ms to 100 ms; Pulsar does not override it. Its SSH agent-forwarding change does not affect Pulsar's shell usage.
WebSocketErrormoves fromorg.apache.pulsar.websockettoorg.apache.pulsar.websocket.data; its constants and error codes are unchanged.