Skip to content

build(release): add central-publishing-maven-plugin to release profile (D3)#97

Merged
DemchaAV merged 1 commit into
developfrom
build/central-publishing-plugin
May 31, 2026
Merged

build(release): add central-publishing-maven-plugin to release profile (D3)#97
DemchaAV merged 1 commit into
developfrom
build/central-publishing-plugin

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Summary

Wires up Track D3 — third step of the Maven Central pipeline. Adds Sonatype's central-publishing-maven-plugin 0.7.0 to the existing release profile as a packaging extension, replacing the legacy nexus-staging-maven-plugin + manual staging-repository flow with a single deploy call.

Stacked on D2 (#96). The diff includes the D2 GPG signing block; after D2 merges, this PR's diff will fast-forward to just the D3 additions. Reviewing in either order is fine — the two profiles are independent except both live under <id>release</id>.

Plugin configuration

Setting Value Why
publishingServerId central Matches the <server id="central"> entry the publish workflow (Track D4) writes into ~/.m2/settings.xml from CENTRAL_USERNAME / CENTRAL_TOKEN secrets.
autoPublish false Validation gate before the artefact goes live. The maintainer sanity-checks the first publish on central.sonatype.com and flips this to true once we're confident.
waitUntil validated The build blocks until Sonatype's validator confirms the upload meets Central requirements (signed artefacts, sources/javadoc jars, valid POM metadata). Surfaces errors in the workflow run rather than silently leaving a stuck upload.
<extensions>true</extensions> required Plugin must participate in the build lifecycle as a packaging extension.

Verification

$ ./mvnw -B -ntp -DskipTests -P release package -pl .
BUILD SUCCESS

Deploy step not exercised locally — no credentials configured, no namespace verified yet. That's Track D4's setup phase.

CHANGELOG entry added to v1.6.6 — Planned under ### Build.

What this doesn't do

  • Does not deploy anything. The plugin is inert until deploy runs with credentials in ~/.m2/settings.xml.
  • Does not verify the namespace. The maintainer must verify io.github.demchaav on central.sonatype.com (one-time, via GitHub auth or DNS TXT record).
  • Does not wire secrets. CENTRAL_USERNAME + CENTRAL_TOKEN GitHub repo secrets are the human prerequisite. The publish workflow (D4) will read them.

Pipeline state after this PR

Step State
D1 — sources / javadoc jars + SCM ✅ shipped
D2 — GPG signing 🟡 #96 (this PR's parent)
D3 — central-publishing plugin 🟢 this PR
D4 — publish workflow next

Human prerequisites for actual publishing

  1. Generate GPG key locally, upload public key to keyserver pool.
  2. Generate Sonatype Central token at central.sonatype.com → Account → Generate User Token.
  3. Verify io.github.demchaav namespace.
  4. Add four GitHub repo secrets: MAVEN_GPG_PRIVATE_KEY, MAVEN_GPG_PASSPHRASE, CENTRAL_USERNAME, CENTRAL_TOKEN.

All of which I'll capture in the release-process doc alongside the D4 PR.

Test plan

  • mvn -P release -DskipTests package -pl . green
  • Default mvnw verify (no profile) unchanged
  • CI green on PR
  • After D2 merge — rebase onto develop and re-run CI; should be near-trivial fast-forward
  • Reviewer skim — the central-publishing-maven-plugin block (~55 LOC including the explanatory comment) is the load-bearing piece

…e (D3)

Wires up Track D3 from the readiness taskboard — third step of the Maven Central pipeline. Adds Sonatype's central-publishing-maven-plugin 0.7.0 to the existing release profile as a packaging extension, replacing the legacy nexus-staging-maven-plugin + manual staging-repository flow with a single deploy call.

Configuration:

  publishingServerId=central — matches the <server id='central'> entry the publish workflow (Track D4) writes into ~/.m2/settings.xml from CENTRAL_USERNAME / CENTRAL_TOKEN secrets.

  autoPublish=false — validation gate before the artefact goes live. The maintainer sanity-checks the first publish on central.sonatype.com and flips this to true after we're confident.

  waitUntil=validated — block the Maven build until Sonatype's validator confirms the upload meets Central requirements (signed artefacts, sources/javadoc jars, valid POM metadata). Surfaces errors in the workflow run rather than silently leaving a stuck upload.

  <extensions>true</extensions> — required so the plugin participates in the build lifecycle as a packaging extension.

Stacked on top of D2 (#96 build/gpg-signing-profile). Includes the D2 GPG signing block — will fast-forward after D2 merges.

Verification: ./mvnw -P release -DskipTests package -pl . -> BUILD SUCCESS. Deploy step not exercised locally (no credentials configured; that's Track D4's job).

Pipeline state: D1 ✅ + D2 (this PR's parent) + D3 (this PR). D4 publish workflow next. Maintainer's human prerequisite for actual publishing: GPG key generation, GitHub secrets wiring (MAVEN_GPG_*, CENTRAL_*), and namespace verification on central.sonatype.com.
@DemchaAV DemchaAV force-pushed the build/central-publishing-plugin branch from 20af290 to 7f77439 Compare May 31, 2026 16:36
@DemchaAV DemchaAV merged commit b5eaf1e into develop May 31, 2026
11 checks passed
@DemchaAV DemchaAV deleted the build/central-publishing-plugin branch May 31, 2026 16:43
DemchaAV added a commit that referenced this pull request May 31, 2026
Wires up Track D4 - the fourth and final step of the Maven Central pipeline. Fires on the same v* tag push that triggers the existing release.yml workflow.

What the workflow does:

1. Re-runs mvnw verify against the tagged commit (defence-in-depth against a tag pushed from a broken branch).

2. actions/setup-java@v5 imports MAVEN_GPG_PRIVATE_KEY into the runner keyring and writes <server id='central'> credentials block from CENTRAL_USERNAME + CENTRAL_TOKEN secrets into ~/.m2/settings.xml.

3. Runs ./mvnw -P release -Dgpg.skip=false deploy. Release profile (D1) attaches sources + javadoc jars; maven-gpg-plugin (D2) signs them; central-publishing-maven-plugin (D3) uploads to Central and blocks until validation completes.

Hyphenated tags (-rc, -alpha, -beta, -snapshot) are explicitly skipped via the job's if: guard. Those ship only to JitPack + the GitHub Release pre-release surface; Central rejects them anyway.

workflow_dispatch input lets the maintainer re-publish an existing tag without re-cutting it if Central had a transient validator hiccup.

Workflow is dormant until four GitHub repo secrets are wired by the maintainer: MAVEN_GPG_PRIVATE_KEY, MAVEN_GPG_PASSPHRASE, CENTRAL_USERNAME, CENTRAL_TOKEN. docs/contributing/release-process.md section 2.C walks through the one-time setup end-to-end.

Stacked on D3 (#97). After D3 merges, this rebases fast-forward.
DemchaAV added a commit that referenced this pull request May 31, 2026
Wires up Track D4 - the fourth and final step of the Maven Central pipeline. Fires on the same v* tag push that triggers the existing release.yml workflow.

What the workflow does:

1. Re-runs mvnw verify against the tagged commit (defence-in-depth against a tag pushed from a broken branch).

2. actions/setup-java@v5 imports MAVEN_GPG_PRIVATE_KEY into the runner keyring and writes <server id='central'> credentials block from CENTRAL_USERNAME + CENTRAL_TOKEN secrets into ~/.m2/settings.xml.

3. Runs ./mvnw -P release -Dgpg.skip=false deploy. Release profile (D1) attaches sources + javadoc jars; maven-gpg-plugin (D2) signs them; central-publishing-maven-plugin (D3) uploads to Central and blocks until validation completes.

Hyphenated tags (-rc, -alpha, -beta, -snapshot) are explicitly skipped via the job's if: guard. Those ship only to JitPack + the GitHub Release pre-release surface; Central rejects them anyway.

workflow_dispatch input lets the maintainer re-publish an existing tag without re-cutting it if Central had a transient validator hiccup.

Workflow is dormant until four GitHub repo secrets are wired by the maintainer: MAVEN_GPG_PRIVATE_KEY, MAVEN_GPG_PASSPHRASE, CENTRAL_USERNAME, CENTRAL_TOKEN. docs/contributing/release-process.md section 2.C walks through the one-time setup end-to-end.

Stacked on D3 (#97). After D3 merges, this rebases fast-forward.
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.

1 participant