Skip to content

Conversation

@zeevmoney
Copy link
Contributor

@zeevmoney zeevmoney commented Jan 4, 2026

Summary

Migrate from legacy OSSRH/Nexus publishing to the new Maven Central Portal.

Why This is Needed

The current publish workflow fails with 403 Forbidden because Sonatype has transitioned from the legacy OSSRH system to the new Maven Central Portal. The old credentials and API endpoints no longer work.

Changes

Gradle Updates

  • Upgrade Gradle from 7.3.3 to 8.5 (required for plugin compatibility)
  • Replace io.github.gradle-nexus.publish-plugin with com.vanniktech.maven.publish (0.28.0)
  • Configure Maven Central Portal publishing via SonatypeHost.CENTRAL_PORTAL

Workflow Updates

  • Java 11 for build process (SDK still targets Java 8)
  • Updated actions to v4 (checkout, setup-java, wrapper-validation, setup-gradle)
  • New task: publishAndReleaseToMavenCentral replaces old publishToSonatype closeAndReleaseSonatypeStagingRepository

New Environment Variables

The vanniktech plugin uses Gradle project properties:

ORG_GRADLE_PROJECT_mavenCentralUsername
ORG_GRADLE_PROJECT_mavenCentralPassword
ORG_GRADLE_PROJECT_signingInMemoryKey
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword

Required Setup

  1. Generate User Token from Maven Central Portal:

    • Go to Account → Generate User Token
    • This gives you a username and password
  2. Add GitHub Secrets:

    • MAVEN_CENTRAL_USERNAME - Username from token
    • MAVEN_CENTRAL_PASSWORD - Password from token
    • GPG_SIGNING_KEY - (existing)
    • GPG_SIGNING_PASSPHRASE - (existing)

Test Plan

  • ./gradlew build -x test passes locally
  • ./gradlew javadoc passes locally
  • Generate token from Maven Central Portal
  • Add secrets to GitHub repo
  • Test workflow manually

Fixes PER-13671

🤖 Generated with Claude Code

Replace legacy OSSRH/Nexus publishing with the new Maven Central Portal:

- Replace `io.github.gradle-nexus.publish-plugin` with `tech.yanand.maven-central-publish`
- Remove old OSSRH repository configuration
- Add `mavenCentral` block for new Central Portal API
- Update publish workflow to use `publishToMavenCentralPortal` task
- Update GitHub Actions to v4 and add fetch-depth for git-version plugin
- Simplify workflow by separating GitHub Packages and Maven Central steps

The new publishing requires a `MAVEN_CENTRAL_TOKEN` secret generated from
https://central.sonatype.com/account (View Account -> Generate User Token)

Fixes PER-13671

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@linear
Copy link

linear bot commented Jan 4, 2026

zeevmoney and others added 12 commits January 4, 2026 21:07
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Upgrade Gradle from 7.3.3 to 8.5 for plugin compatibility
- Replace legacy nexus-publish plugin with vanniktech/gradle-maven-publish-plugin
- Configure Maven Central Portal publishing (CENTRAL_PORTAL host)
- Update workflows to use Java 11 for building
- Update GitHub Actions to v4 versions
- Use standard Gradle project properties for credentials:
  - ORG_GRADLE_PROJECT_mavenCentralUsername
  - ORG_GRADLE_PROJECT_mavenCentralPassword
  - ORG_GRADLE_PROJECT_signingInMemoryKey
  - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword

Required secrets (generate from https://central.sonatype.com/account):
- MAVEN_CENTRAL_USERNAME: Username from token generation
- MAVEN_CENTRAL_PASSWORD: Password from token generation

Fixes PER-13671

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document Maven Central and GitHub Packages publishing process,
including credentials setup, Gradle tasks, and troubleshooting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add task dependency fix for plainJavadocJar -> generateMetadataFileForMavenPublication
- Remove duplicate withSourcesJar/withJavadocJar (handled by vanniktech plugin)
- Add -PskipSigning flag for local testing without GPG keys
- Update PUBLISHING.md with skipSigning documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove S01 and DEFAULT publishing types from PUBLISHING.md
- Update build.gradle comments to reference maven-publish plugin

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use 2.2.+ version range to auto-select latest patch version
- Link to Maven Central for explicit version lookup
- Update Javadoc URLs to use /latest/ path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zeevmoney zeevmoney marked this pull request as ready for review January 4, 2026 20:59
@zeevmoney zeevmoney requested a review from Copilot January 4, 2026 21:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the SDK's publishing infrastructure from the legacy OSSRH/Nexus system to the new Maven Central Portal to resolve authentication failures. The migration includes upgrading Gradle from 7.3.3 to 8.5 and replacing the Nexus publishing plugin with the Vanniktech Maven publish plugin.

Key changes:

  • Replaced publishing plugin and updated to Gradle 8.5 for compatibility
  • Updated GitHub Actions workflow to use Java 11 for builds and new publishing tasks
  • Added comprehensive publishing documentation with setup instructions

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
gradle/wrapper/gradle-wrapper.properties Upgraded Gradle from 7.3.3 to 8.5
README.md Updated version references to use flexible version range and latest javadoc links
PUBLISHING.md Added comprehensive guide for Maven Central Portal publishing setup and workflows
.github/workflows/publish.yaml Migrated workflow to Java 11, updated actions to v4, and replaced publishing tasks with new Maven Central Portal commands
.github/workflows/javadoc.yaml Updated Java version to 11 and actions to v4 for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

zeevmoney and others added 5 commits January 4, 2026 23:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The NEXUS_TOKEN_* secrets contain the Central Portal token credentials.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zeevmoney zeevmoney requested a review from Copilot January 4, 2026 21:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@permitio permitio deleted a comment from Copilot AI Jan 4, 2026
@permitio permitio deleted a comment from Copilot AI Jan 4, 2026
@zeevmoney zeevmoney merged commit 9b067bf into master Jan 4, 2026
2 checks passed
@zeevmoney zeevmoney deleted the zeev/per-13671-migrate-java-sdk-publishing-to-new-maven-central-portal branch January 4, 2026 21:25
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.

2 participants