DeepMedia logo
Open Source
Search...

Other versions of this page

Improve this page on GitHub

Search

Central Portal

Central Portal is Sonatype's new publishing mechanism that serves as a modern entry point to the Maven Central repository.

⚠️

The portal is a recent addition in the Maven Central publishing ecosystem. If you have pushed to Maven Central before, you likely need to use our Nexus support.

Add a new spec with centralPortalSpec {} and start configuring it:

kotlin
deployer { // Common configuration... project.description.set("Handy tool to publish maven packages in different repositories.") centralPortalSpec { // Take these credentials from the Generate User Token page at https://central.sonatype.com/account auth.user.set(secret("CENTRAL_PORTAL_USER")) auth.password.set(secret("CENTRAL_PORTAL_PASSWORD")) // Signing is required signing.key.set(secret("SIGNING_KEY")) signing.password.set(secret("SIGNING_PASSWORD")) } // If needed, you can add other named specs and configure them differently. // Each spec gets its own deploy* task. centralPortalSpec("foo") { ... } }

Maven Central sync

Central Portal deployments, when properly configured, will be synced to Maven Central. For this to happen you generally need three steps:

  1. Build maven packages with a very strict set of rules (for example, signing is mandatory)
  2. Upload them, for example through the web interface at https://central.sonatype.com
  3. Wait for validation, then finalize the deployment for it to be synced to Maven Central

Deployer plugin will take care of these steps for you:

  • It validates your artifacts and POM file locally, to ensure they won't be rejected by the backend
  • It fails with clear errors if any issue is found
  • It uses Sonatype's REST APIs to upload your artifacts (even if they belong to different specs!)
  • It uses Sonatype's REST APIs to finalize the deployment after validation

Disallowing finalization

If you'd rather do the third step on your own (for example, because you want to check the files in the web interface before they get synced), you have the option to do so:

kotlin
deployer { ... centralPortalSpec { allowMavenCentralSync = false } }

When allowMavenCentralSync is set to false, the deploy task (e.g. deployCentralPortal) will be considered successful if the remote validation succeeds, and all that's left for Maven Central sync is that you finalize the deployment manually through Sonatype's web interface.

Subscribe to the DeepMedia Newsletter

The latest news about DeepMedia products, open source projects and software development at our company.

By clicking “Subscribe”, you agree that DeepMedia may use your email address to send you newsletters, including commercial communications, and to process your personal data for this purpose. You agree that DeepMedia may process said data using third-party services for this purpose in accordance with the DeepMedia Privacy Policy. You can revoke this consent at any time using the unsubscribe link included in each email or by writing at contact@deepmedia.io.