Publishing -SNAPSHOT Releases⚓︎
-SNAPSHOT
releases
are intended for developers to make pre-release versions of their projects
available for testing. While the versions of components retrieved from Maven
Central are guaranteed to not change,
-SNAPSHOT versions are intended to be overwritten. This enables developers to
work with the latest version of a library without needing to update their
dependencies repeatedly.
As -SNAPSHOT releases are not final releases on Maven Central, they are not
subject to the same guarantees. Specifically, -SNAPSHOT releases are cleaned
up after a period of time (currently 90 days). We believe that this should be
sufficient, as projects under active development will be pushing new versions of
the same -SNAPSHOT component with some frequency.
As with the legacy OSSRH -SNAPSHOT publishing, no validation is performed. If
you wish to test releases that have gone through validation, we have a feature
that enables integrating your deployment files into your build for purposes of
manually testing a release before it reaches Maven
Central.
Enabling -SNAPSHOT Releases For Your Namespace⚓︎
Prerequisites
If you have not yet registered a namespace, please follow our namespace registration documentation.
First, navigate to the namespaces
page. Find the namespace
you plan on publishing -SNAPSHOT releases to and click on its dropdown menu.

From there, select the "Enable SNAPSHOTs" menu option.

This will open a confirmation popup. Selecting "Confirm" on the popup will
enable -SNAPSHOT publishing on that namespace. You will then see a badge on
the namespace indicating that -SNAPSHOT publishing is enabled.

Publishing -SNAPSHOT Releases For Your Project⚓︎
Because publishing -SNAPSHOT releases does not perform validation on the
component(s), a mvn deploy-compatible API was chosen for maximum ecosystem
compatibility.
Publishing with the central-publishing-maven-plugin⚓︎
The central-publishing-maven-plugin supports snapshot releases directly.
Publishing with a -SNAPSHOT version will automatically upload the component to
the right location. Please be sure that you are using a version of the plugin
equal to or newer than 0.7.0.
If you want to publish your snapshots to your own hosting repository, the plugin
respects Maven's <distributionManagement> configuration (Maven
Documentation),
which should allow you to configure a location for your -SNAPSHOT releases.
Specifically, you will need to configure a <snapshotRepository> or a
<repository> with <snapshots><enabled>true</enabled></snapshots>.
Publishing via other methods⚓︎
Since this feature is new, third-party plugins may take time to support it. For
now, you will be able to fall back on publishing via your build tool of choice's
support for -SNAPSHOT releases.
For Maven, you can use the default Maven Deploy
Plugin configured with
<distributionManagement> with the URL
https://central.sonatype.com/repository/maven-snapshots/.
For Gradle, you can use the default Maven
Publish
plugin. You'll want to configure a maven repository with the url of
https://central.sonatype.com/repository/maven-snapshots/ (relevant
documentation).
Consuming -SNAPSHOT Releases For Your Project⚓︎
Consuming Via Maven⚓︎
Configure your pom.xml file with the following <repositories> section:
<repositories>
<repository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Consuming Via Gradle⚓︎
Configure your build.gradle file with the following:
repositories {
maven {
name = 'Central Portal Snapshots'
url = 'https://central.sonatype.com/repository/maven-snapshots/'
// Only search this repository for the specific dependency
content {
includeModule("<the snapshot's groupId>", "<the snapshot's artifactId>")
}
}
mavenCentral()
}