Skip to content

lalakii/central-portal-plus

Repository files navigation

CentralPortalPlus

Maven Central License: Apache-2.0 (shields.io)

The plugin implements sonatype's Central Publisher API (part of).

It will call maven-publish to generate artifacts and publish them to sonatype's central portal.

Note: This is a third party plugin.

Usage

Apply this plugin in gradle:

plugins {
    id("cn.lalaki.central") version "1.2.5"
}

Add configuration:

val localMavenRepo = uri("path/of/local_repo") // The path is recommended to be set to an empty directory
centralPortalPlus {
    url = localMavenRepo
    username = "..."
    password = "..."
    publishingType = PublishingType.USER_MANAGED // or PublishingType.AUTOMATIC
}

Configure maven-publish as before, doc: Maven Publish Plugin, or see: sample/build.gradle.kts

publishing {
    repositories {
        maven {
            url = localMavenRepo // Specify the same local repo path in the configuration.
        }
    }
    // ...
}

You are now ready to start the task of publishing to the Central Portal.

# windows
.\gradlew publishToCentralPortal

# other
./gradlew publishToCentralPortal

If you need to check the status of the deployment. (If no parameter is provided, the default value will be the last deployment Id)

.\gradlew dumpDeployment -PutId="deployment Id"

If you want to remove the deployment. (If no parameter is provided, the default value will be the last deployment Id)

.\gradlew deleteDeployment -PutId="deployment Id"

Note: deployments that have been successfully published cannot be deleted.

If you need to get the deployment Id, visit: Maven Central: Publishing.

End for now