publishToMavenCentral

fun publishToMavenCentral(automaticRelease: Boolean = false, validateDeployment: Boolean = true)

Sets up Maven Central publishing through Sonatype OSSRH by configuring the target repository. Gradle will then automatically create a publishAllPublicationsToMavenCentralRepository task as well as include it in the general publish task.

When the automaticRelease parameter is true the created deployment will be released automatically to Maven Central without any additional manual steps needed. When automaticRelease is not set or false the deployment has to be manually released through the Central Portal website.

If the current version ends with -SNAPSHOT the artifacts will be published to Sonatype's snapshot repository instead.

This expects you provide the username and password of a user token through Gradle properties called mavenCentralUsername and mavenCentralPassword. See here for how to obtain a user token.

When validateDeployment is true (the default), the plugin will monitor the deployment status after upload and wait until it reaches a terminal state (PUBLISHED or FAILED). Deployment validation only happens when automaticRelease is true.

Parameters

automaticRelease

whether a non SNAPSHOT build should be released automatically at the end of the build

validateDeployment

whether to wait for the deployment to be validated and published at the end of the build