Skip to content

Fix snapshot publishing: server id mismatch in central-publishing-maven-plugin - #770

Merged
eitch merged 1 commit into
mainfrom
fix/snapshot-publish-server-id
Oct 1, 2026
Merged

eitch merged 1 commit into
mainfrom
fix/snapshot-publish-server-id

Conversation

@FDelporte

Copy link
Copy Markdown
Member

Summary

  • central-publishing-maven-plugin was configured with publishingServerId=central, but distributionManagement/snapshotRepository uses id sonatype-oss-snapshots, and the CI snapshot workflow's generated settings.xml only defines a server with that latter id.
  • Because this plugin (extensions=true) takes over the deploy phase entirely, it couldn't resolve credentials for central and silently skipped the upload on every snapshot build — mvn deploy reported BUILD SUCCESS but nothing was ever actually published.
  • Confirmed via the Sonatype Central snapshots repo: com/pi4j/pi4j-core doesn't exist at all under https://central.sonatype.com/repository/maven-snapshots/, despite many "successful" ci-main-snapshot.yml runs.
  • This surfaced downstream in Pi4J/pi4j-drivers, whose CI fails to resolve com.pi4j:pi4j-core:5.0.0-SNAPSHOT.

Fix

Set publishingServerId to sonatype-oss-snapshots so it matches both distributionManagement and the CI-generated settings.xml.

This only affects snapshot publishing — the release flow (ci-release-to-maven.yml) builds with -DaltDeploymentRepository=local::file:./target/staging-deploy, which stages locally and hands off to JReleaser for the actual Maven Central upload, bypassing this server id entirely.

Test plan

  • Merge and confirm ci-main-snapshot.yml deploy step now shows an actual upload/publish log line for pi4j-core
  • Confirm com.pi4j:pi4j-core:5.0.0-SNAPSHOT (and pi4j-plugin-ffm) become resolvable at https://central.sonatype.com/repository/maven-snapshots/
  • Confirm pi4j-drivers CI build turns green again

🤖 Generated with Claude Code

central-publishing-maven-plugin was configured with
publishingServerId=central, but distributionManagement's
snapshotRepository (and the CI settings.xml) use the id
sonatype-oss-snapshots. Since the plugin takes over the deploy
phase, it couldn't resolve credentials for "central" and silently
skipped the upload on every snapshot build, so pi4j-core and the
plugins were never actually published despite CI reporting success.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 07:33
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The changed setting is not used by the configured snapshot path and instead affects release authentication.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates Maven publishing credentials to address failed snapshot deployments.

Changes:

  • Changes the Central publishing server ID to sonatype-oss-snapshots.
File Description
pom.xml Updates the publishing plugin’s server ID.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pom.xml Resolved

@eitch eitch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@eitch
eitch merged commit dfcb452 into main Oct 1, 2026
6 checks passed
@eitch
eitch deleted the fix/snapshot-publish-server-id branch October 1, 2026 07:40
stefanhaustein pushed a commit to stefanhaustein/pi4j that referenced this pull request Oct 2, 2026
The previous fix (Pi4J#770) was wrong — Copilot correctly pointed out that
publishingServerId is never consulted for snapshot deploys once
distributionManagement/snapshotRepository is defined, which it already
was here.

The real problem: central-publishing-maven-plugin (extensions=true)
relies on an AbstractMavenLifecycleParticipant that mutates the raw
POM Model at afterProjectsRead time to rebind the deploy phase to its
own "publish" goal. Under this project's Maven 4.0.0-rc-5, that
mutation does not propagate to the lifecycle executor, so neither the
plugin's "publish" goal nor the default maven-deploy-plugin ends up
bound to the deploy phase at all. `mvn deploy` therefore reports BUILD
SUCCESS while uploading nothing, for every module, snapshot or
release. Verified locally with a local staging deploy repository:
zero deploy-phase executions with the plugin enabled, full
reactor-wide deploy:deploy execution (pi4j-core and pi4j-plugin-ffm
included) immediately after removing it.

Since the actual release flow already goes through JReleaser
(ci-release-to-maven.yml) independently of this plugin, and the
existing distributionManagement/snapshotRepository config already
has matching credentials in the CI-generated settings.xml, plain
maven-deploy-plugin is sufficient for snapshot publishing. Also drops
the plugin's now-dead reference in the unused "deploy" profile and
its version property.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
IAmNickNack pushed a commit to IAmNickNack/pi4j that referenced this pull request Oct 3, 2026
The previous fix (Pi4J#770) was wrong — Copilot correctly pointed out that
publishingServerId is never consulted for snapshot deploys once
distributionManagement/snapshotRepository is defined, which it already
was here.

The real problem: central-publishing-maven-plugin (extensions=true)
relies on an AbstractMavenLifecycleParticipant that mutates the raw
POM Model at afterProjectsRead time to rebind the deploy phase to its
own "publish" goal. Under this project's Maven 4.0.0-rc-5, that
mutation does not propagate to the lifecycle executor, so neither the
plugin's "publish" goal nor the default maven-deploy-plugin ends up
bound to the deploy phase at all. `mvn deploy` therefore reports BUILD
SUCCESS while uploading nothing, for every module, snapshot or
release. Verified locally with a local staging deploy repository:
zero deploy-phase executions with the plugin enabled, full
reactor-wide deploy:deploy execution (pi4j-core and pi4j-plugin-ffm
included) immediately after removing it.

Since the actual release flow already goes through JReleaser
(ci-release-to-maven.yml) independently of this plugin, and the
existing distributionManagement/snapshotRepository config already
has matching credentials in the CI-generated settings.xml, plain
maven-deploy-plugin is sufficient for snapshot publishing. Also drops
the plugin's now-dead reference in the unused "deploy" profile and
its version property.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.

3 participants