[improve][build] Add Maven publishing conventions for ASF release#25457
Merged
merlimat merged 5 commits intoapache:masterfrom Apr 8, 2026
Merged
Conversation
Add `pulsar.publish-conventions` Gradle convention plugin that configures maven-publish and GPG signing for all publishable modules, matching the artifact coordinates previously produced by the Maven build. The convention plugin handles: - java-library modules: JAR + sources + javadoc + POM + Gradle metadata - java-platform modules (BOM/dependencies): POM + Gradle metadata only - Shadow/shaded modules: shadow JAR as primary artifact - NAR modules: .nar as primary artifact with packaging=nar - ASF-compliant POM metadata (license, SCM, issue management, mailing lists) - GPG signing (configurable, disabled by default for local dev) - Local deploy repository for testing (build/local-deploy-repo) - Configuration cache compatible
merlimat
reviewed
Apr 1, 2026
nodece
reviewed
Apr 2, 2026
nodece
reviewed
Apr 2, 2026
…properties - Publish root project as parent POM (org.apache.pulsar:pulsar) with all shared ASF metadata (license, SCM, organization, mailing lists, developers, issue management) - Child module POMs now reference the parent via <parent> element, inheriting metadata instead of embedding it in every POM - Move group and version from version catalog / java-conventions to gradle.properties (standard Gradle pattern for project coordinates) - Remove pulsar version from libs.versions.toml
nodece
approved these changes
Apr 3, 2026
… publish Add `pulsar.public-java-library-conventions` plugin that combines `pulsar.java-conventions` and `pulsar.publish-conventions` into a single plugin for published Java library modules. This establishes a clear convention boundary: modules using this plugin are public libraries published to Maven repositories, while internal-only modules use just `pulsar.java-conventions`. Also fix NAR module detection to use deferred `pluginManager.withPlugin` instead of eager `plugins.hasPlugin`, ensuring correct behavior regardless of plugin application order.
…ed projects Add a publish-time validation check that ensures all project dependencies in publishable scopes (api, implementation, runtimeOnly) point to projects that also apply maven-publish. This prevents mistakes where a consumer downloading from Maven Central couldn't resolve a dependency because the referenced module was never published. Test/compileOnly scoped dependencies are excluded since they don't appear in the published POM.
merlimat
reviewed
Apr 8, 2026
- Move NAR publishing into pulsar.nar-conventions: applies pulsar.publish-conventions and configures NAR-specific publication with .nar artifact and empty POM (no dependencies) - NAR modules use pulsar.java-conventions + pulsar.nar-conventions instead of pulsar.public-java-library-conventions - Downgrade jclouds-shaded to internal (only used by tiered-storage NAR) - Move dependency validation from pulsar.publish-conventions to pulsar.public-java-library-conventions (NAR modules don't need it) - Disable publishing for example NAR modules
merlimat
approved these changes
Apr 8, 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 Pulsar build was migrated from Maven to Gradle, but Maven publishing (deploying artifacts to Maven repositories) was not yet implemented. This PR adds the publishing infrastructure so artifacts land at the same Maven coordinates as before (
org.apache.pulsar:*), with proper POM metadata, GPG signing, sources/javadoc JARs, and Gradle module metadata.Modifications
Parent POM (
build.gradle.kts)The root project publishes
org.apache.pulsar:pulsaras a POM-only parent artifact containing all shared ASF metadata (license, SCM, organization, mailing lists, developers, issue management). Child module POMs reference this via<parent>, inheriting metadata instead of embedding it — matching the Maven build's parent POM structure.Convention plugins (
build-logic/)pulsar.public-java-library-conventions(new) — combined plugin for published Java library modules that applies bothpulsar.java-conventionsandpulsar.publish-conventions. Establishes a clear convention boundary: modules using this plugin are public libraries published to Maven, while internal-only modules use justpulsar.java-conventions. Includes dependency validation ensuring public modules don't depend on unpublished projects.pulsar.publish-conventions(new) — core publishing plugin configuringmaven-publishandsigning:.module), with version mapping that inlines resolved dependency versions into the POMpulsar-bom,pulsar-dependencies): publishes POM + Gradle module metadata only (no JAR), with<packaging>pom</packaging>and<dependencyManagement>entriespulsar-client-shaded,pulsar-client-admin-shaded,pulsar-client-all, etc.): publishes the shadow JAR as the primary artifact<parent>injection: every child POM gets a<parent>reference to the root parent POM viawithXml<scope>compile</scope>(Maven default) and<dependencyManagement>from non-platform POMsuseGpgCmd,signing.gnupg.keyName,signing.gnupg.homeDir), disabled by default for local developmentbuild/local-deploy-repoviapublishAllPublicationsToLocalDeployRepositorytaskpulsar.nar-conventions(updated) — now appliespulsar.publish-conventionsand configures NAR-specific publishing:.narartifact with<packaging>nar</packaging><dependencies>section — NAR bundles everythingjava-examples-builtin,client-tools-customcommand-example) disable publishing explicitlyModule changes
id("pulsar.public-java-library-conventions")id("pulsar.java-conventions")+id("pulsar.nar-conventions")— publishing comes fromnar-conventionspulsar-bom,pulsar-dependencies): useid("pulsar.publish-conventions")directlybuildtools,tests/*,microbench,jclouds-shaded, etc.): useid("pulsar.java-conventions")Modules changed to internal (no longer published):
jclouds-shaded— only referenced bytiered-storage/jcloud(a NAR module that bundles it)Project coordinates (
gradle.properties)Moved
groupandversionfrom the version catalog /pulsar.java-conventionstogradle.properties— the standard Gradle pattern. Gradle auto-applies these to all projects.Other
gradle.properties: addedsystemProp.org.gradle.internal.publish.checksums.insecure=truefor ASF Nexus compatibilitygradle/setup-test-gpg.sh: helper script to create a temporary GPG keyring for testing signing without touching~/.gnupgVerifying this change
./gradlew publishAllPublicationsToLocalDeployRepository— all 58 modules published successfully (52 java-library + 4 NAR + 2 platform)org.apache.pulsar:pulsar)<parent>reference and no inline metadatapulsar-bomproduces only.pom+.modulefiles with<dependencyManagement>entriespulsar-client-shadedpublishes 24MB shadow JAR as primary artifact.narwith<packaging>nar</packaging>and no<dependencies>sectionjclouds-shadedis NOT publishedjava-examples-builtin,client-tools-customcommand-example) are NOT published.ascfiles when configured with a test key.modulefiles) published alongside all POMsimplementation(project(":buildtools"))to a published module correctly fails with:Does this pull request potentially affect one of the following parts:
Documentation
doc-not-needed