Skip to content

Publish snapshots via Maven's timestamped unique-snapshot protocol - #90

Merged
ghackett merged 1 commit into
mainfrom
timestamped-snapshot-publish
Jul 19, 2026
Merged

Publish snapshots via Maven's timestamped unique-snapshot protocol#90
ghackett merged 1 commit into
mainfrom
timestamped-snapshot-publish

Conversation

@ghackett

Copy link
Copy Markdown
Member

What

Sonatype central's maven-snapshots repo only registers the FIRST plain PUT of a non-unique snapshot filename (foo-1.0-SNAPSHOT.jar): later republishes of the same -SNAPSHOT version are accepted (200, last-modified even updates) but never served — the repo's maven-metadata.xml keeps pointing at the first build forever. This bit tacita on episode6/tacita#20, where every republish of 0.0.4-SNAPSHOT kept serving the version's original pre-PR bytes, breaking consumers' CI with unresolved references. This repo's publish workflow used the same plain-PUT loop, so it carries the same latent bug.

Changes

  • New scripts/upload-snapshots.py (ported verbatim from tacita): publishes snapshots via Maven's timestamped unique-snapshot protocol — timestamped filenames (foo-1.0-<timestamp>-<build>.jar) plus a regenerated per-module maven-metadata.xml with an incremented buildNumber, which is what mvn/gradle do natively when deploying snapshots remotely and what central requires for a snapshot overwrite to actually be served.
  • publish-artifacts.yml: the snapshot branch of the publish step calls the script instead of the curl PUT loop. The release path (bundle POST to the publisher API) is unchanged.

Validation

  • The identical script + workflow change shipped on Add byte-level ad-creative fingerprint store tacita#20: immediately after that republish, central served the new buildNumber with the correct bytes, and a clean Gradle project resolved the fixed snapshot from the remote repo (verified by sha1 and javap).
  • This PR carries the publish-snapshot label, so its Publish Artifacts run publishes 2.0.0-alpha04-SNAPSHOT through the new path end-to-end.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xg5JMK3qu2NPT6qKtDj5H6

Sonatype central only registers the FIRST plain PUT of a non-unique
snapshot filename; the repo's maven-metadata.xml keeps pointing at that
build, so republishing a -SNAPSHOT version is accepted but never served.
scripts/upload-snapshots.py (ported from tacita) uploads timestamped
filenames and re-PUTs each module's maven-metadata.xml with an
incremented buildNumber, matching what mvn/gradle do when deploying a
snapshot remotely.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xg5JMK3qu2NPT6qKtDj5H6
@ghackett ghackett added the publish-snapshot Publish snapshot artifacts from this PR label Jul 19, 2026
@ghackett
ghackett marked this pull request as ready for review July 19, 2026 20:44
@ghackett
ghackett merged commit 3e6d463 into main Jul 19, 2026
5 checks passed
@ghackett
ghackett deleted the timestamped-snapshot-publish branch July 19, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

publish-snapshot Publish snapshot artifacts from this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant