Skip to content

build(release): add GPG signing plugin to release profile (D2)#96

Merged
DemchaAV merged 1 commit into
developfrom
build/gpg-signing-profile
May 31, 2026
Merged

build(release): add GPG signing plugin to release profile (D2)#96
DemchaAV merged 1 commit into
developfrom
build/gpg-signing-profile

Conversation

@DemchaAV
Copy link
Copy Markdown
Owner

Summary

Wires up Track D2 — Maven Central rejects unsigned uploads; this PR adds maven-gpg-plugin 3.2.7 to the existing release profile so the main / sources / javadoc / pom artefacts are signed during the verify phase.

Off by default

Surface Behaviour
mvn -P release package (local) Signing skipped — no GPG key required. New <gpg.skip>true</gpg.skip> property in <properties> keeps every local invocation working.
mvn -P release -Dgpg.skip=false verify (manual) Plugin attempts to sign. Without a configured key, expected GPG exit code 2.
Publish workflow (Track D4) Flips -Dgpg.skip=false explicitly and provides MAVEN_GPG_PRIVATE_KEY + MAVEN_GPG_PASSPHRASE from repo secrets.

gpgArguments declares --pinentry-mode loopback so non-interactive CI runs accept the passphrase from -Dgpg.passphrase / MAVEN_GPG_PASSPHRASE without needing a TTY for gpg-agent.

Verification

Default (skip=true):

$ ./mvnw -B -ntp -DskipTests -P release verify -pl .
[INFO] --- gpg:3.2.7:sign (sign-artifacts) @ graphcompose ---
[INFO] BUILD SUCCESS

Sign step engaged but silently skipped via <skip>${gpg.skip}</skip>.

Forced (skip=false), no key:

$ ./mvnw -B -ntp -DskipTests -P release -Dgpg.skip=false verify -pl .
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:3.2.7:sign: Exit code: 2

Expected — confirms the plugin would actually attempt signing when the workflow flips the switch.

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

What this doesn't do

  • Does not wire up secrets. MAVEN_GPG_PRIVATE_KEY and MAVEN_GPG_PASSPHRASE are GitHub repo secrets the maintainer must create after generating the GPG key and uploading the public key to the keyserver pool. Until then, this PR is dormant — no publish workflow yet (Track D4), and the local default keeps everything green.
  • Does not pick a key. The GPG plugin signs with whatever key the agent / gpg --homedir resolves; that policy lives outside the pom.

Pipeline state after this PR

Step State
D1 — sources / javadoc jars + SCM ✅ shipped
D2 — GPG signing 🟢 this PR
D3 — central-publishing plugin next
D4 — publish workflow after D3

Maintainer GPG key generation and GitHub secret wiring is the human prerequisite before D4's workflow will actually publish anything; the plugin / workflow side will be ready and waiting.

Test plan

  • Default mvn -P release verify green locally
  • mvn -P release -Dgpg.skip=false verify correctly attempts signing (expected failure without key)
  • No regression on default mvnw verify (no profile activation)
  • CI green on PR (enforcer / japicmp / no-poi / guards / JDK matrix)
  • Reviewer skim — the GPG plugin block (~30 LOC) and the <gpg.skip>true</gpg.skip> property are the load-bearing pieces

Wires up Track D2 from the readiness taskboard - the second step of the Maven Central pipeline. Maven Central rejects unsigned uploads; this PR adds maven-gpg-plugin 3.2.7 to the existing release profile so the main / sources / javadoc / pom artefacts get signed during the verify phase.

Off by default: new <gpg.skip>true</gpg.skip> property keeps local mvn -P release package runs working without a configured GPG key. The publish workflow (Track D4) flips it explicitly with -Dgpg.skip=false once MAVEN_GPG_PRIVATE_KEY and MAVEN_GPG_PASSPHRASE secrets are wired.

gpgArguments declares --pinentry-mode loopback so non-interactive CI runs accept the passphrase from env / system property without needing a TTY for gpg-agent.

Verification:

  mvnw -P release -DskipTests verify -pl . (default skip=true) -> BUILD SUCCESS, sign step silently skipped

  mvnw -P release -Dgpg.skip=false -DskipTests verify -pl . -> BUILD FAILURE with gpg exit code 2 (expected - no key configured locally; proves plugin would attempt signing)

Pipeline state after this PR: artefacts (D1) + signing (D2) ready; central-publishing (D3) and workflow (D4) pending. Maintainer GPG key generation and GitHub secret wiring is the human prerequisite before D4's workflow will actually publish anything.
@DemchaAV DemchaAV merged commit a8c08cb into develop May 31, 2026
11 checks passed
@DemchaAV DemchaAV deleted the build/gpg-signing-profile branch May 31, 2026 16:36
DemchaAV added a commit that referenced this pull request May 31, 2026
…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 added a commit that referenced this pull request May 31, 2026
…e (D3) (#97)

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.
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