Skip to content

Commit f8d00db

Browse files
committed
[1.x] Update Sonatype publishing
1 parent 0de6dd5 commit f8d00db

1 file changed

Lines changed: 9 additions & 63 deletions

File tree

src/reference/01-General-Info/05-Using-Sonatype.md

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,22 @@ Using Sonatype
2323

2424
Publishing to the Central Repository is easy!
2525

26-
#### Central Portal and Legacy OSSRH
26+
#### Publishing to the Central Repository
2727

28-
The Central Repository (aka Maven Central) has long been the pillar of the JVM ecosystem,
29-
including Scala. The mechanism to publish libraries to the Central has been hosted by Sonatype
30-
as OSS Repository Hosting (OSSRH) via `HTTP PUT`; however, in March 2025 it was
31-
[announced][20250326_ossrh_sunset] that the endpoint will be sunset on June 30th, 2025
32-
in favor of the Central Portal at <https://central.sonatype.com/>.
28+
In March 2025, Sonatype [announced][20250326_ossrh_sunset] that its Legacy OSSRH HTTP endpoints to publish to the Central Repository (aka Maven Central) would be sunset in favor of the Central Portal at <https://central.sonatype.com/>.
3329

3430
<table style="border: 1px solid gray; width: 80%;">
3531
<tr><th>&nbsp;</th><th>Central Portal</th> <th>Legacy OSSRH</th></tr>
36-
<tr><td>sbt version</td> <td>Use sbt <b>1.11.0-RC2</b>+</td> <td>Any sbt 1.x version</td></tr>
37-
<tr><td>Availability</td> <td>Available</td> <td>Sunset on 2025-06-30</td></tr>
32+
<tr><td>Availability</td> <td>✅ Available</td> <td>❌ Sunset on 2025-06-30</td></tr>
33+
<tr><td>sbt version</td> <td>Use sbt <b>1.12.15</b>+</td> <td>n/a<td></tr>
34+
<tr><td>Command</td> <td><b><pre>+publishSigned; sonaRelease</pre></b></td> <td><pre>+publishSigned</pre><td></tr>
3835
</table>
3936
<br>
4037

41-
Publishing to the Central Portal is built into sbt, for sbt 1.11.0-RC2 and above.
42-
The rest of this page will document the publishing process for Central Portal,
43-
but there are some notes at the end for the Legacy OSSRH publishing.
38+
**⚠️ Note**: Note that with the new setup, `publishSigned` will only release to the staging directory. Run `sonaUpload` or `sonaRelease` command additionally to release the staged artifacts.
39+
40+
When sbt 1.11.0 was released, sbt incorporated the Sonatype's publishing API.
41+
The rest of this page will document the publishing process for Central Portal, step by step.
4442

4543
#### Central Portal registration
4644

@@ -276,55 +274,3 @@ releaseStepCommand("publishSigned"),
276274
releaseStepCommand("sonaRelease"),
277275
...
278276
```
279-
280-
<a id="ossrh"></a>
281-
### Publishing to the Legacy OSSRH
282-
283-
#### Credentials for the Legacy OSSRH
284-
285-
The credentials for your OSSRH account need to be stored
286-
somewhere safe (*e.g. NOT in the repository*). Common convention is a
287-
`$global_base$/sonatype.sbt` file, with the following:
288-
289-
```scala
290-
credentials += Credentials(Path.userHome / ".sbt" / "sonatype_credentials")
291-
```
292-
293-
Next create a file `~/.sbt/sonatype_credentials`:
294-
295-
```
296-
realm=Sonatype Nexus Repository Manager
297-
host=oss.sonatype.org
298-
user=<your username>
299-
password=<your password>
300-
```
301-
302-
> *Note:* The first two strings must be `"Sonatype Nexus Repository Manager"`
303-
> and `"oss.sonatype.org"` for Coursier to use the credentials. If you are using
304-
> an OSSRH account created between February 2021 and May 2025, use `"s01.oss.sonatype.org"`
305-
> instead of `"oss.sonatype.org"`
306-
307-
#### sbt setup for the Legacy OSSRH
308-
309-
```scala
310-
ThisBuild / publishTo := {
311-
// For accounts created after Feb 2021:
312-
// val nexus = "https://s01.oss.sonatype.org/"
313-
val nexus = "https://oss.sonatype.org/"
314-
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
315-
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
316-
}
317-
```
318-
319-
#### The Legacy OSSRH publishing step
320-
321-
From sbt shell run:
322-
323-
```
324-
> publishSigned
325-
```
326-
327-
Check the published artifacts in the [Nexus Repository Manager][sonatype-nexus]
328-
(same login as Sonatype's Jira account).
329-
Close the staging repository and promote the release to central, by hitting
330-
"Close" button, then "Release" button.

0 commit comments

Comments
 (0)