-
Notifications
You must be signed in to change notification settings - Fork 61
Add SNAPSHOT publishing to Maven Central #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds automatic SNAPSHOT publishing to Maven Central's snapshots repository (https://central.sonatype.com/repository/maven-snapshots/) when commits are pushed to the main branch. Key insight: Unlike release publishing, SNAPSHOT publishing does NOT require GPG signatures or validation. This makes the implementation much simpler - we can use standard `mvn deploy:deploy-file` instead of the bundle-based Central Publisher API. Changes: - Add `scripts/jdbc_maven_deploy_snapshot.py` that uses Maven's deploy:deploy-file goal to upload pre-built JARs - Add `maven-snapshot-deploy` job to Java.yml workflow that runs after all platform builds complete on main branch The SNAPSHOT version is automatically calculated by incrementing the minor version from the last release tag (e.g., v1.4.x.x -> 1.5.0.0-SNAPSHOT). Closes duckdb#338 References: - https://central.sonatype.org/publish/publish-portal-snapshots/ - https://central.sonatype.org/news/20250114_snapshot_publishing_via_portal/
Version v1.4.4.0 should produce 1.4.5.0-SNAPSHOT (not 1.5.0.0-SNAPSHOT)
e.g., v1.4.4.0 + commit abc1234 -> 1.4.5.0-abc1234-SNAPSHOT
- Rename exec() to run_cmd() to avoid shadowing Python built-in - Move imports to top-level (zipfile, shutil) - Fix inefficient zipfile handling - single open instead of per-iteration - Add cleanup of temp directories (staging_dir, javadoc_dir) - Add timeout-minutes: 30 to workflow job - Add docstring explaining version component behavior - Extract create_nolib_jar to separate function
|
Hi, thanks for the PR! We may want to have it sharing some logic with the main publishing in future, but for now I think it would be better to keep it completely separate. Going to merge it now, lets look how it works from main. If you see some changes needed after the merge - feel free to file follow-up PRs! |
|
The deploy is failing on Maven push step. Credentials are definitely correct as they were used for release publishing yesterday. If you would like to investigate this - Sonatype provides pre-verified Maven accounts when logging into Sonatype Portal with a Github account. Such account won't be different in any way (except the |
|
Hi @staticlibs! Thanks for merging the PR! I investigated the 403 Forbidden error and I suspect SNAPSHOT publishing might not be enabled yet for the According to the Sonatype documentation, SNAPSHOT publishing requires explicit enablement per namespace, separate from regular release publishing. Could you check if this is the case? Here's how to verify and enable it:
Once enabled, the CI job should succeed on the next push to Let me know if it turns out to be something else - happy to investigate further! |
|
Thanks for the details! I think you might be correct. While the snapshots were enabled there before, they well may have been auto-disabled when the publishing changes were applied by Sonatype back in August. Unfortunately I don't have the direct access to the Sonatype account (only board members have), I raised this internally and will comment here when have an update on this. |
|
@staticlibs Any chance to get it fixed today? |
No, I don't think so, I will comment here if I have new info. |
Summary
This PR adds automatic SNAPSHOT publishing to Maven Central's snapshots repository when commits are pushed to the main branch.
Key insight: Unlike release publishing, SNAPSHOT publishing does NOT require GPG signatures or validation (announced by Sonatype in January 2025). This makes the implementation much simpler - we can use standard
mvn deploy:deploy-fileinstead of the bundle-based Central Publisher API.Changes
scripts/jdbc_maven_deploy_snapshot.py- New script that uses Maven'sdeploy:deploy-filegoal to upload pre-built JARs tohttps://central.sonatype.com/repository/maven-snapshots/.github/workflows/Java.yml- Addedmaven-snapshot-deployjob that:mainbranch (not PRs, not tags)MAVEN_USERNAMEandMAVEN_PASSWORDsecretsHow it works
v1.4.4.0+ commitabc1234→1.4.5.0-abc1234-SNAPSHOTmvn deploy:deploy-filewhich handles:Usage
Once published, users can consume SNAPSHOTs by adding:
Maven:
sbt:
Available Classifiers
In addition to the main JAR, several classifier variants are published:
noliblinux_amd64linux_arm64linux_amd64_musllinux_arm64_muslmacos_universalwindows_amd64windows_arm64When to use each:
Example using nolib:
Example using architecture-specific (sbt):
Test plan
Closes #338
References