Skip to content

Commit b5eaf1e

Browse files
authored
build(release): add central-publishing-maven-plugin to release profile (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.
1 parent a8c08cb commit b5eaf1e

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ JitPack continue to resolve through the existing coordinates.
2121
`./mvnw -DskipTests -P japicmp verify -pl .`; HTML/MD/XML reports
2222
land in `target/japicmp/`. JitPack repository is scoped to the
2323
`japicmp` profile, so downstream consumers do not inherit it.
24+
- **`central-publishing-maven-plugin` in the `release` profile**
25+
(Track D3). Adds Sonatype's `central-publishing-maven-plugin` 0.7.0
26+
to the existing `release` profile as a packaging extension. Replaces
27+
the legacy `nexus-staging-maven-plugin` + manual staging-repository
28+
workflow with a single `deploy` call. Configuration:
29+
`publishingServerId=central` (matches the `<server id="central">`
30+
entry the publish workflow writes from `CENTRAL_USERNAME` /
31+
`CENTRAL_TOKEN` secrets), `autoPublish=false` (validation gate before
32+
the artefact goes live — flips to `true` once we're confident
33+
post-D4), `waitUntil=validated` (the build waits for Sonatype's
34+
validator so any rejection surfaces in the workflow run, not a
35+
silent stuck upload). Requires the `io.github.demchaav` namespace to
36+
be verified on `central.sonatype.com` (one-time human step via
37+
GitHub auth or DNS TXT record). The plugin loads inert until D4's
38+
workflow provides the credentials.
2439
- **GPG signing in the `release` profile** (Track D2). Adds
2540
`maven-gpg-plugin` 3.2.7 to the existing `release` profile, binding
2641
to the `verify` phase to sign main / sources / javadoc / pom

pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<byteBuddy.version>1.18.8</byteBuddy.version>
6666

6767
<!-- Build plugins -->
68+
<central.publishing.plugin.version>0.7.0</central.publishing.plugin.version>
6869
<maven.compiler.plugin.version>3.15.0</maven.compiler.plugin.version>
6970
<maven.enforcer.plugin.version>3.5.0</maven.enforcer.plugin.version>
7071
<maven.gpg.plugin.version>3.2.7</maven.gpg.plugin.version>
@@ -555,6 +556,54 @@
555556
</execution>
556557
</executions>
557558
</plugin>
559+
<!--
560+
Sonatype central-publishing-maven-plugin: the
561+
modern replacement for the old `nexus-staging-maven-plugin`
562+
+ manual staging-repository flow. Uploads the
563+
signed artefacts (main + sources + javadoc + pom)
564+
to the namespace verified at central.sonatype.com.
565+
566+
Configuration:
567+
publishingServerId=central — matches the
568+
<server id="central"> entry the publish
569+
workflow (Track D4) writes into
570+
~/.m2/settings.xml from the CENTRAL_USERNAME
571+
/ CENTRAL_TOKEN repo secrets.
572+
autoPublish=false — uploads to the validation
573+
queue but does NOT auto-release. The
574+
maintainer flips the switch on
575+
central.sonatype.com after a sanity check
576+
on the first publish; subsequent releases
577+
can flip this to true in the workflow when
578+
we are confident.
579+
waitUntil=validated — block the Maven build
580+
until Sonatype's validator confirms the
581+
upload meets the Central requirements
582+
(signed artefacts, sources/javadoc jars,
583+
valid POM metadata, etc.). Surfaces errors
584+
inside the workflow run rather than
585+
silently leaving a stuck upload.
586+
<extensions>true</extensions> — required so
587+
the plugin participates in the build
588+
lifecycle as a packaging extension.
589+
590+
Requires (configured by Track D4 workflow):
591+
- CENTRAL_USERNAME / CENTRAL_TOKEN secrets
592+
- namespace `io.github.demchaav` verified on
593+
central.sonatype.com (one-time, via GitHub
594+
auth or DNS TXT record).
595+
-->
596+
<plugin>
597+
<groupId>org.sonatype.central</groupId>
598+
<artifactId>central-publishing-maven-plugin</artifactId>
599+
<version>${central.publishing.plugin.version}</version>
600+
<extensions>true</extensions>
601+
<configuration>
602+
<publishingServerId>central</publishingServerId>
603+
<autoPublish>false</autoPublish>
604+
<waitUntil>validated</waitUntil>
605+
</configuration>
606+
</plugin>
558607
</plugins>
559608
</build>
560609
</profile>

0 commit comments

Comments
 (0)