Fix Maven Central publish: migrate to Sonatype Central Portal - #326
Open
Narayana Shanbhog Plivo (narayana-plivo) wants to merge 1 commit into
Open
Fix Maven Central publish: migrate to Sonatype Central Portal#326Narayana Shanbhog Plivo (narayana-plivo) wants to merge 1 commit into
Narayana Shanbhog Plivo (narayana-plivo) wants to merge 1 commit into
Conversation
Every release after v5.46.0 (2025-04-30) has been tagged in git but never made it to Maven Central. Sonatype retired the legacy OSSRH staging API mid-2025 and the io.codearte.nexus-staging plugin v0.30.0 we used only spoke that API — uploads silently went nowhere. 15 tags (v5.46.1 .. v5.50.0) are missing from Maven Central as a result, including v5.48.0 which contains the Jackson 2.20 compatibility fix (PropertyNamingStrategies.SNAKE_CASE) blocking a customer. Changes: - Swap io.codearte.nexus-staging 0.30.0 -> io.github.gradle-nexus.publish-plugin 2.0.0 (Central Portal-compatible via the OSSRH Staging API bridge). - Point at https://ossrh-staging-api.central.sonatype.com/service/local/ and central.sonatype.com snapshots. - Drop the manual publishing.repositories.maven { url ... } block — nexus-publish adds a staged 'sonatype' repository automatically; the manual one would create a second, non-staged target that skips close. - Rewire the 'upload' task to depend on publishToSonatype + closeAndReleaseSonatypeStagingRepository so plivo_standard_libs@sdks Jenkins pipeline invocations keep working. - Update publish.sh accordingly. Requires (ops): - Central Portal user-token issued at central.sonatype.com/account exported as MAVEN_USERNAME / MAVEN_PASSWORD in Jenkins credentials. Old OSSRH tokens do not work with the Portal. - com.plivo namespace visible under Namespaces on the Central Portal (auto-migrated by Sonatype in mid-2025; confirm before first publish).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause of 15 missing releases. Every plivo-java tag after v5.46.0 (2025-04-30) — v5.46.1 through v5.50.0 — is in git but not on Maven Central. Sonatype retired the legacy OSSRH staging API mid-2025 (see Central Portal migration); our
io.codearte.nexus-stagingplugin v0.30.0 only spoke that API, so./gradlew publishuploaded to nothing.Customer impact: at least one customer is blocked on v5.48.0 which contains the
PropertyNamingStrategy.SNAKE_CASE→PropertyNamingStrategies.SNAKE_CASEchange needed for Jackson 2.20+ (Spring Boot 3.5.16 fails at startup withNoSuchFieldErroron the old constant). Their workaround pins Jackson to 2.19.4, blocking security patches.What this changes:
io.codearte.nexus-staging0.30.0 →io.github.gradle-nexus.publish-plugin2.0.0 (Central Portal–compatible via the OSSRH Staging API bridge).ossrh-staging-api.central.sonatype.com/service/local/; snapshots atcentral.sonatype.com/repository/maven-snapshots/.publishing.repositories.maven { url ... }block.nexus-publishadds a stagedsonatyperepository automatically; the manual one produced a second, non-staged target that skipped close-and-release.uploadtask topublishToSonatype+closeAndReleaseSonatypeStagingRepositorysoplivo_standard_libs@sdksJenkins pipeline invocations keep working (see caveat below).publish.shaccordingly.The OSSRH Staging API bridge does not support looking up an existing staging repository (returns HTTP 400: "Endpoint /service/local/staging/profile_repositories/ not supported" — see upstream gradle-nexus/publish-plugin#379). This means:
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository(one invocation) — works../gradlew upload(this PR's task, depends on both) — works../publish.sh(this PR's rewrite) — works../gradlew publishToSonatypein one step, then./gradlew closeAndReleaseSonatypeStagingRepositoryin a separate step — fails at find-repo lookup../gradlew publishalone — uploads to staging but does not close/release; artifact sits OPEN in the Portal and never reaches Maven Central.Action required: confirm the
sdksPipelinestep inplivo_standard_libs@sdksinvokes./gradlew uploador./publish.shor the fullpublishToSonatype closeAndReleaseSonatypeStagingRepositorychain — not a bare./gradlew publish.Ops prerequisites before merging
MAVEN_USERNAME/MAVEN_PASSWORDin the Jenkins credential store. Old OSSRH tokens do not work (upstream #384).com.plivonamespace is visible under Namespaces on the Central Portal (auto-migrated by Sonatype mid-2025; usually fine but confirm).SONATYPE_SECRET_RING_FILE(unchanged — thesigning { }block is unchanged).Known upstream flakiness (documented, not blocking merge)
The bridge API itself has documented reliability issues that no plugin config can fully mitigate: socket timeouts on
close, occasional "No objects found in the repository" 400s (upstream #398, openremote#2523). This PR increasesclientTimeout/connectTimeoutto 5 min and retries to 180 to widen the window. If the first publish attempt times out mid-close, the release may still succeed server-side — check the Portal UI before retrying.PR Template
Type of Change: bug fix (publish pipeline; no runtime code change).
Impact on Prepaid Customers: none — build/CI-only change.⚠️ Static verification only. Plugin coordinates + version resolve on Gradle Plugin Portal; DSL properties (
Impact on Postpaid Customers: none — build/CI-only change.
Impact on downstream services: unblocks Maven Central publishes; downstream customers on Jackson ≥ 2.20 get an upgrade path.
Impact on upstream services: none.
Rollback Plan: revert this commit. Rollback is safe — the old plugin was already producing no artifacts.
Unit tests: N/A — no runtime code change.
Tested locally / staging:
nexusUrl,snapshotRepositoryUrl,username,password,connectTimeout,clientTimeout,transitionCheckOptions{maxRetries, delayBetween}) and task classes (InitializeNexusStagingRepository,CloseNexusStagingRepository,ReleaseNexusStagingRepository) confirmed against the actual plugin class files. Config shape matches TWiStErRob/net.twisterrob.gradle#951 which publishes successfully to Central. Requires a real smoke publish before merging.Opsgenie alerts: N/A.
Sensitive data: none in this diff; credentials sourced from env / Jenkins.
Related: Customer ticket from Karthik G. — "Plivo SDK Jackson Compatibility Issue" (Jackson 2.20 /
NoSuchFieldErroronPropertyNamingStrategy.SNAKE_CASE).Test plan
./gradlew tasks --group=publishinglistspublishToSonatype,closeSonatypeStagingRepository,releaseSonatypeStagingRepository,closeAndReleaseSonatypeStagingRepository../gradlew publishToMavenLocalsucceeds (validates POM, signing, artifacts) without needing Sonatype creds.5.50.1-SNAPSHOTand run./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepositoryin a single invocation — artifact appears in the Portal's Deployments view, transitions VALIDATED → PUBLISHED, and is resolvable athttps://repo1.maven.org/maven2/com/plivo/plivo-java/<version>/within ~30 min.Notes for reviewer(s) / QA
🤖 Generated with Claude Code