sbt-sonatype icon indicating copy to clipboard operation
sbt-sonatype copied to clipboard

Publish to Maven Central with new interface

Open Tammo0987 opened this issue 1 year ago • 13 comments

Hello, I am asking for help. Since it seems like, that the old Jira from Sonatype will be shutdown and only https://central.sonatype.com will be used. I wanted to ask if I can get currently the plugin running with an user token created from the new interface and how I should configure it.

When I use s01.oss.sonatype.org as described, I get an error for to many redirects.

Tammo0987 avatar Jan 25 '24 21:01 Tammo0987

I've the same issue. I cannot publish to central.sonatype.org due to too many redirect errors

rlemaitre avatar Feb 02 '24 15:02 rlemaitre

I wasn't aware of this change: https://central.sonatype.org/register/central-portal/#switching-to-ossrh-during-portal-early-access. In fact, I don't know much about this change and I don't have an account on the new http://central.sonatype.org/ to test it.

It seems Sonatype has renewed almost all steps to register new domains, so I also need to relearn everything from scratch, including its API and token management 😓

xerial avatar Feb 02 '24 17:02 xerial

If you can identify what needs to be fixed in sbt-sonatype and highlight the necessary code changes (for example, a pull request), I would appreciate it. I can create a new release soon.

xerial avatar Feb 02 '24 17:02 xerial

Almost same issue here (encountered by using sbt-typelevel). Sonatype says they provide new API for publishing artifacts. We may use new endpoint, new API.

I'll check code anyway :)

windymelt avatar Feb 05 '24 18:02 windymelt

It looks like a big change and more automation has been added on the sonatype side 😮 https://central.sonatype.org/publish/publish-portal-api/

xerial avatar Feb 05 '24 19:02 xerial

At first glance, it looks like a huge improvement. I'd like to support the new https://central.sonatype.com/ API in sbt-sonatype 4.x

xerial avatar Feb 05 '24 21:02 xerial

According to the documentation, it is no longer possible to create a new account on the old system, so Scala library author who recently created an account on the new system are effectively unable to publish libraries (except hand-made publish process).

windymelt avatar Feb 26 '24 14:02 windymelt

See the following PR for an initial implementation that offers Sonatype Central support: https://github.com/xerial/sbt-sonatype/pull/474

Andrapyre avatar Feb 27 '24 03:02 Andrapyre

For users needing immediate support to publish libraries, the following is a temporary workaround:

  1. Download the changes in https://github.com/xerial/sbt-sonatype/pull/474.
  2. Run
sbt "compile; publishLocal"
  1. Copy the package id from the output: <User Dir>/.ivy2/local/org.xerial.sbt/sbt-sonatype/scala_2.12/sbt_1.0/<package-id>/ivys/ivy.xml
  2. Go to your project, checkout a new branch, and add the following to plugins.sbt :
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "<package-id>")
  1. In your project, add the following to your build.sbt:
import xerial.sbt.Sonatype.sonatypeCentralHost

ThisBuild / sonatypeCredentialHost := sonatypeCentralHost
ThisBuild / version := "<target version>"
  1. Generate credentials in Sonatype Central and add them to your .zsh like so:
export SONATYPE_USERNAME="<sonatype_username>"
export SONATYPE_PASSWORD="<sonatype_password>"
  1. If you have not already done so, follow the instructions here to set up GPG.
  2. Run the following and paste in your gpg-generated passphrase when prompted
sbt "publishSigned" 
  1. Run
sbt "sonatypeBundleRelease"
  1. Go to https://central.sonatype.com/publishing/deployments, verify that all is working as expected with your deployment and publish your component when ready.

Andrapyre avatar Feb 27 '24 03:02 Andrapyre

Heyo! Really happy to see that support for the new interface is moving along. Are there any info that can be shared regarding when we can expect a release candidate with this change included? Like was mentioned here https://github.com/xerial/sbt-sonatype/pull/474

Ragazoor avatar Apr 08 '24 17:04 Ragazoor

I was in contact with Taro and he needed some extra time to review this, with one or two further considerations around user flow and naming, which are still TBD. @xerial , could we still get a release commit out in the current form, with a target date for a full 4.0.0 release in a month or two? That way we can gather user feedback while still making clear that setting names, etc. are open to change.

Andrapyre avatar Apr 10 '24 23:04 Andrapyre

@xerial , I am confused about this new release, as I'd thought that this was permanently blocked and I instead invested effort to create a separate plugin here - https://github.com/lumidion/sbt-sonatype-central with a maintenance and feature roadmap. This plugin is now in its first release...as of a few minutes before https://github.com/xerial/sbt-sonatype/pull/474 was merged.

The next step to make this feature widely available is to integrate it into sbt-ci-release. Do you have bandwidth/interest in maintaining it in this repo? If yes, I will continue with my original plan from several months ago and add the changes to sbt-ci-release without introducing the plugin I've created. If not, I would request that this feature be reverted (it has commands that will conflict with the new plugin) and I will integrate the new plugin into sbt-ci-release instead.

Andrapyre avatar Jun 27 '24 04:06 Andrapyre