Quickstart
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 project.
- Compatible with multi-project builds.
- Uses classloader isolation to prevent conflicts with other plugins.
- Uses Gradle 8.8 lifecycle callbacks for easy configuration.
Requirements
Nmcp requires Java 17+, Gradle 8.8+ for the settings plugin and Gradle 8.2+ otherwise.
Configuring 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:
plugins { id("com.gradleup.nmcp.settings").version("1.4.0")}
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# yay everything is uploaded π# go to https://central.sonatype.com/ to release if you used USER_MANAGEDCall publishAggregationToCentralPortalSnapshots to publish to the snapshots:
./gradlew publishAggregationToCentralPortalSnapshots# yay everything is 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.