[improve][build] Improve the gradle build to use similar best practices as apache/pulsar build#10
Merged
lhotari merged 33 commits intoapache:masterfrom Apr 2, 2026
Merged
Conversation
…s as apache/pulsar build
merlimat
approved these changes
Apr 2, 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
The upstream apache/pulsar repository refactored its Gradle build after the initial Gradle support (commit 5b9fe44) to adopt Gradle best practices: convention plugins, composite builds, lazy configuration, and better tooling. The pulsar-connectors build was still using a monolithic root
build.gradle.ktswith asubprojects {}block for all shared configuration. This PR aligns the connectors build with the upstream patterns and picks up several improvements.Modifications
Convention plugins (
build-logic/composite build):pulsar-connectors.java-conventions— shared Java compilation, dependencies, test configuration, Lombokpulsar-connectors.nar-conventions— NAR packaging with lazy artifact resolution, disables the default JAR task, and publishes NAR as the project artifact forruntimeElementsandapiElementsconfigurationspulsar-connectors.shadow-conventions— Shadow JAR as primary artifact (matching upstreampulsar.shadow-conventions)pulsar-connectors.code-quality-conventions— Spotless license header enforcementbuild.gradle.ktsreduced from ~286 lines to ~104 lines (RAT + allprojects + IDEA copyright + version tooling)plugins {}blockdistribution/io,docker/pulsar-all) usebaseplugin instead of disabledjava-libraryLazy configuration (configure-on-demand support):
tasks.withType<X>().configureEachinstead of eagertasks.withType<X>configurations.named().map {}instead of eager.get()providers.gradleProperty()instead ofSystem.getProperty()for test system propertiesDependency management improvements:
pulsar-dependenciestopulsar-connectors-dependenciesapi(platform(...))instead of constraints (matching upstream commit d155a47)slf4j-bom,log4j-bom,protobuf-bom,grpc-bom,jetty-bom,simpleclient-bom,opentelemetry-bom(+ alpha/instrumentation variants),okhttp3-bom,okio-bom,mockito-bom,testcontainers-bom,aws-java-sdk-bompulsarConnectorsDependenciesextension tojava-conventionsfor controlling how the shared platform is applied — subprojects can exclude specific dependencies from enforcement (e.g.,exclude(group = "io.netty", module = "netty-bom")) or switch fromenforcedPlatformtoplatform(viaenforced = false) when a module needs to override versionsfastutildependency (removed in upstream)Version updates (aligned with upstream):
New tooling:
./gradlew spotlessCheck/./gradlew spotlessApply)idea-extplugin)version-catalog-updateplugin (./gradlew versionCatalogUpdate/./gradlew versionCatalogFormat)versionsplugin (./gradlew dependencyUpdatesfor HTML report of available updates)settings.gradle.ktsConnector doc generator (
docs/module):ConnectorDocGeneratorto scan NAR files from the classpath using properjar:file:URLsgenerateConnectorDocsGradle task (JavaExec) with input/output tracking for up-to-date checksexportClasspathtask andpulsar-io-gen.shshell script as an alternative way to run the generatorAlluxio connector fixes:
jetty-bomfromenforcedPlatformadded byjava-conventionsto avoid version conflictsAlluxioSinkimplementationAlluxioSinkTestTest improvements:
testLogging { events("FAILED"); exceptionFormat = FULL }— show test failure detailsfailFastproperty support on test tasks-PtestShowOutputto display test stdout/stderr-Xlint:deprecation,-Xlint:uncheckedCI & documentation:
spotlessCheckalongside RATVerifying this change
This change is already covered by existing tests. Additionally verified:
./gradlew assemble— all modules compile and package successfully./gradlew --configuration-cache assemble— configuration cache works ("Configuration cache entry reused")./gradlew spotlessCheck— all license headers pass./gradlew rat— license audit passesDoes this pull request potentially affect one of the following parts:
Documentation
doc-complete