Maven Central FAQ
This page is not directly related to Nmcp but lists some of the frequently asked questions about Maven Central that came up during the development of this plugin.
Q: What is the Portal Publisher API?
The Portal Publisher API is the new way to upload and manage your Maven Central deployments.
The web UI is available at https://central.sonatype.com/.
Q: Do I need to migrate my account?
If your account was created after March 12th 2024, it uses https://central.sonatype.com/ by default, and you can use this plugin directly.
If your account was created before, and you used to log in to https://oss.sonatype.org or https://central.sonatype.com/, you now need to log in to https://central.sonatype.com/.
Your previous credentials should work to log in the web UI. If not, contact the central support at central-support@sonatype.com.
You need to create a user token to use the Central Portal Publisher API programmatically.
See this page for more details.
Q: this requires a lot of changes to my build logic. Do I have to use the new Portal API?
Because it’s not always convenient to change your build logic, the Sonatype team introduced a compatibility OSSRH url so you can use your current tooling to publish to the Central portal. Typically, this is done by replacing your repository url:
repositories { maven { name = 'ossrh-staging-api' url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" }}Or if you were using S01:
repositories { maven { name = 'ossrh-staging-api' url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" }}Q: Can I still use oss.sonatype.org/s01.oss.sonatype.org?
No, the date for OSSRH sunsetting was June, 30th 2025. The service is now EOL.
Q: What is the difference between the Portal API and the previous OSSRH API?
The Portal API is a single HTTP POST request that uploads a .zip file containing all your artifacts, signatures, .pom, .module files, etc…
The previous OSSRH had multiple endpoints to create/release/delete staging repositories. Files were uploaded one by one using multiple HTTP PUT requests. You also had the option to upload files directly without creating a staging repository and an implicit staging repository would be created automatically based on your IP address.
Q: Is the Central Portal better than the older OSSRH?
What better means is very subjective, obviously.
Overall, there are a number of advantages to the Central Portal:
- The UI feels more modern.
- The Portal API is clearly documented.
- The
zipapproach makes deployments more atomic. No more weird half-closed staging repos. - More generally, uploading everything all at once simplifies the upload process and removes the heuristics where staging repositories were created based on your IP, causing split repos and other issues.
There are also a few friction points:
- the stats are hosted on a different service, which doesn’t seem to provide the same access to the raw data as the previous OSSRH. That part is still relatively new so still under investigation.
- Uploading the zip file in one go is generally slower since you can’t upload files as they are built by Gradle. You may create several zips if you upload different projects in parallel, but you won’t be able to beat the raw speed of the previous scheme. Since publishing should preferably be done in CI and doesn’t use dev machine time, this drawback might or might not be important for you.
The migration also broke browsing the SNAPSHOTs, so it’s not all sunshine and roses.
But a facelift on OSSRH was certainly needed, and the system will hopefully improve gradually from that point.
Q: Where do I find the stats in the Central Portal?
See the question above. You can opt in scarf.sh to get your download data.
Q: What is Sonatype?
Sonatype is the company that operates Maven Central.
Q: Can I host commercial software on Maven Central?
Yes. It is discouraged, and the Portal checks require that you upload a sources jar. But that sources jar may be empty if your project is closed source.
Q: Something went wrong, can I contact Sonatype support?
Yes. You can contact Sonatype support at central-support@sonatype.com.
Q: How long does it take to publish something on Maven Central?
It depends. It ranges from a couple of minutes to a few hours. The validation step (verifying signatures, source jars, etc…) is usually faster, in the order of minutes per project. The publishing part may take longer.
If your deployment reaches the PUBLISHING state it should become available on Maven Central at some point.
Q: What API is used to upload SNAPSHOTs?
Uploading to the SNAPSHOTs (https://central.sonatype.com/repository/maven-snapshots/) still uses the old OSSRH file-by-file API.
Nmcp has its own implementation of a Maven Publisher that uploads the artifact files and updates the maven-metadata.xml files for keeping track of the versions.
Q: Why can’t I browse SNAPSHOTs?
Browsing the SNAPSHOTs is currently not working.
Q: My deployment failed to upload with status XXX? What is going on?
The status codes are not documented, but a community maintained list is available in the source code. If you bump into an unknown status code, please send a PR!
Q: My deployment failed but the status page is all green?
https://status.maven.org/ is not always up to date, and sometimes the service is down even if the status page doesn’t show it. If nothing else works, wait a few hours before retrying.