As of 2025-06-30, everything that used to work to publish Java packages into https://mvnrepository.com/ will no longer work: https://central.sonatype.org/news/20250326_ossrh_sunset/
Since I am using the maven-deploy-plugin, the instructions at https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/ talk about the interim process to keep using the existing plugin. Supposedly they want us to switch to the new plugin central-publishing-maven-plugin. However, for now, these changes will make things work with the existing plugin(s).
Get New User Token & Password
- Sign into to https://central.sonatype.com/
- Select “View User Tokens” under the menu dropdown on the top-right (https://central.sonatype.com/usertoken)
- Create a new token.
- Record the token and password somewhere safe as instructed.
Modify settings.xml to Use New Token & Password
The file settings.xml can be store in different places (~/.m2/conf, $MAVEN_HOME/conf, etc.). Look for it and modify the <server> configuration to use the new token and password.
Modify pom.xml files to use the new host ossrh-staging-api.central.sonatype.com EVERYWHERE (use global replace to make sure you catch all the places) the old one (e.g. s01.oss.sonatype.org) is.
Manual Closing of Repositories
For my top-level POM, I used to have to manually close a repository after uploading. I used to do this by logging into https://s01.oss.sonatype.org and using the UI there. The new portal https://central.sonatype.com/, however, doesn’t have this UI.
One way to achieve this is to use an API to do it:
- Apply BASE64 encoding to “
<user token>:<password>“ - Note the namespace of the repository. This can be found at https://central.sonatype.com/publishing/namespaces. For me, it’s
com.therealvan. - On the same machine/IP where the deployment is done, run this cURL command (or use something like Postman to do the equivalent):
curl -X POST \
-H "Authorization: Bearer {BASE64(token:password)}" \
-H "Content-Type: application/json" \
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/{namespace}"
where {BASE64(token:password)} is the BASE64 encoded value of the user token & password and {namespace} is the namespace of the repository.
- Head to https://central.sonatype.com/publishing to find the “Deployment” created and click the “Publish” button. This is equivalent to closing the repository from the old UI. Note that there is also a “Drop” button to drop/abort just as the old UI did.
Optionally, add ?publishing_type=automatic parameter to the URL and see if it does that last part for you. I haven’t tested this.