Skip to content

Fix Maven Central publishing after OSSRH sunset - #8

Merged
NoahHsu merged 5 commits into
mainfrom
fix/maven-central-publish
Aug 19, 2026
Merged

NoahHsu merged 5 commits into
mainfrom
fix/maven-central-publish

Conversation

@fukuanru

@fukuanru fukuanru commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Publishing to Maven Central has never succeeded (no artifacts exist under com.linecorp.flagship4j on Central). This PR fixes the three root causes:

  1. OSSRH sunset: oss.sonatype.org was permanently shut down on 2025-06-30. Both publishing endpoints in this repo still pointed to it. Now nexusPublishing targets the Central Portal OSSRH Staging API compatibility service (ossrh-staging-api.central.sonatype.com), with snapshots going to central.sonatype.com/repository/maven-snapshots/.
  2. Subproject version was unspecified: since Update versioning and publishing configuration #7 moved version from gradle.properties into the root build.gradle, only the root project got the version (Gradle does not inherit version). Wrapped in allprojects { } so published artifacts get the real version.
  3. Wrong secrets / duplicate repository: the workflow read non-existent OSSRH_USERNAME / OSSRH_TOKEN secrets — switched to the org-provided MAVEN_CENTRAL_USERNAME / MAVEN_CENTRAL_PASSWORD (Central Portal user token). Also removed the duplicate direct-deploy OSSRH repository in gradle/publish.gradle, and changed the publish command to the plugin-recommended publishToSonatype closeAndReleaseSonatypeStagingRepository.

Additionally, the release tag's v prefix is now stripped (vX.Y.Z → X.Y.Z) and the version is set before the build step.

Verification

Verified locally with JDK 8 (same as CI) in Docker:

  • ./gradlew assemble — BUILD SUCCESSFUL
  • With SDK_VERSION=0.1.99: generated POM has correct groupId/version; subprojects no longer resolve to unspecified
  • --dry-run publishToSonatype closeAndReleaseSonatypeStagingRepository — task graph wires correctly; example modules are excluded from publishing

Before releasing

  • Confirm MAVEN_CENTRAL_USERNAME / MAVEN_CENTRAL_PASSWORD secrets contain a Central Portal user token (legacy OSSRH tokens get 401 on the new API)
  • Confirm GPG_KEY_ID / GPG_PRIVATE_KEY / GPG_PASSWORD secrets exist (signing is skipped silently if missing, and Central rejects unsigned artifacts)
  • Test the flow via workflow_dispatch with a test version before the next real release

🤖 Generated with Claude Code

fukuanru and others added 2 commits August 19, 2026 16:24
- Point nexusPublishing at the Central Portal OSSRH Staging API
  compatibility service (oss.sonatype.org was shut down on 2025-06-30)
- Remove the duplicate direct-deploy OSSRH repository in publish.gradle
- Propagate version to all subprojects via allprojects (previously only
  the root project got it, so artifacts were published as "unspecified")
- Read credentials from MAVEN_CENTRAL_USERNAME / MAVEN_CENTRAL_PASSWORD
  secrets (Central Portal user token) instead of OSSRH_USERNAME / OSSRH_TOKEN
- Strip the "v" prefix from release tags, set the version before building,
  and use publishToSonatype closeAndReleaseSonatypeStagingRepository

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Aug 19, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

fukuanru and others added 3 commits August 19, 2026 16:39
- actions/checkout v3/v4.2.2 -> v7.0.1
- actions/setup-java v3/v4 -> v5.7.0
- actions/github-script v7.0.1 -> v9.0.0
- gradle/wrapper-validation-action (deprecated) -> gradle/actions/wrapper-validation v6.3.0

All actions are now pinned to full commit SHAs with version comments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Restores full commit SHA pinning (with version comments) for all
actions to guard against tag-rewrite supply chain attacks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@NoahHsu NoahHsu 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.

LGTM

@NoahHsu
NoahHsu merged commit c24da84 into main Aug 19, 2026
2 checks passed
@fukuanru
fukuanru deleted the fix/maven-central-publish branch August 20, 2026 06:27
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