| title | Quickstart |
|---|
import { Aside } from '@astrojs/starlight/components';
Nmcp (New Maven Central Publishing) is a plugin that uses the new Central Portal publisher API to publish existing publications to Maven Central and Snapshots.
Nmcp is compatible with modern Gradle development practices:
- Compatible with Configuration Cache.
- Compatible with Isolated projects.
- Compatible with multi-project builds.
- Uses classloader isolation to prevent conflicts with other plugins.
- Uses Gradle 8.8 lifecycle callbacks for easy configuration.
For a higher level API use vanniktech/gradle-maven-publish-plugin.
Nmcp requires Java 17+, Gradle 8.2+ and Gradle 8.8+ for the settings plugin.
We recommend using the settings plugin to configure all your logic in your settings.gradle[.kts] file. For a lower level API, you may also apply the Nmcp plugins directly in your build.gradle[.kts] files. See the manual configuration page for more details.
Add the com.gradleup.nmcp.settings plugin to your settings.gradle[.kts] file and configure the nmcpAggregation extension:
// settings.gradle[.kts]
plugins {
id("com.gradleup.nmcp.settings").version("1.4.4")
}
nmcpSettings {
centralPortal {
username = TODO("Create a token username at https://central.sonatype.com/")
password = TODO("Create a token password at https://central.sonatype.com/")
// optional: publish manually from the portal
publishingType = "USER_MANAGED"
// optional: configure the name of your publication in the portal UI
publicationName = "my-publication:$version"
// optional: increase the validation timeout to 30 minutes
validationTimeout = java.time.Duration.of(30, ChronoUnit.MINUTES)
// optional: disable waiting for publishing
publishingTimeout = java.time.Duration.ZERO
// optional: send publications serially instead of in parallel (might be slower)
uploadSnapshotsParallelism.set(1)
}
}Call publishAggregationToCentralPortal to publish the aggregation:
./gradlew publishAggregationToCentralPortal
# Your deployment is uploaded
# go to https://central.sonatype.com/ to release it if you used USER_MANAGEDCall publishAggregationToCentralSnapshots to publish to the snapshots:
./gradlew publishAggregationToCentralSnapshots
# Your snapshots are uploaded to "https://central.sonatype.com/repository/maven-snapshots/"Under the hood, the com.gradle.nmcp.settings plugin applies the com.gradleup.nmcp plugin to all your projects and com.gradleup.nmcp.aggregation to your root project.
If you're using Gradle < 8.8, if you have a convention plugin or if you need more control over the aggregation, you may also configure the subplugins manually and get more control.
See the manual configuration page for more details.