Skip to content

Commit

Permalink
v13.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
natario1 committed Jul 28, 2024
1 parent 356ee10 commit b1563fe
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 19 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
A lightweight, handy Gradle plugin to deploy your maven packages (for example, Android AARs, Java JARs, Kotlin KLibs)
to different kinds of repositories. It supports publishing to:
- local directories, to use them as local maven repositories in other projects
- [Maven Central](https://central.sonatype.org/) repository via Sonatype's OSSRH
- [Maven Central](https://central.sonatype.com/) repository via Sonatype's OSSRH
- [Maven Central](https://central.sonatype.com/) repository via Sonatype's [Central Portal](https://central.sonatype.org/register/central-portal/)
- Other Sonatype Nexus repositories
- [GitHub Packages](https://docs.github.com/en/packages)

Expand All @@ -26,7 +27,7 @@ pluginManagement {

// build.gradle.kts of deployable modules
plugins {
id("io.deepmedia.tools.deployer") version "0.12.0"
id("io.deepmedia.tools.deployer") version "0.13.0"
}
```

Expand Down
3 changes: 2 additions & 1 deletion docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ docs:
`MavenDeployer` is a lightweight, handy Gradle plugin to deploy your maven packages (for example, Android AARs, Java JARs, Kotlin KLibs)
to different kinds of repositories. It supports publishing to:
- local directories, to use them as local maven repositories in other projects
- [Maven Central](https://central.sonatype.org/) repository via Sonatype's OSSRH
- [Maven Central](https://central.sonatype.com/) repository via Sonatype's OSSRH
- [Maven Central](https://central.sonatype.com/) repository via Sonatype's [Central Portal](https://central.sonatype.org/register/central-portal/)
- Other Sonatype Nexus repositories
- [GitHub Packages](https://docs.github.com/en/packages)

Expand Down
4 changes: 3 additions & 1 deletion docs/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ pluginManagement {

// build.gradle.kts of deployable modules
plugins {
id("io.deepmedia.tools.deployer") version "0.12.0"
id("io.deepmedia.tools.deployer") version "LATEST_VERSION"
}
```

Replace `"LATEST_VERSION"` with the latest version number, {version}.

## Snapshots

The plugin uses an older version of itself to publish itself to the Maven Central repository
Expand Down
71 changes: 71 additions & 0 deletions docs/repos/central-portal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Central Portal
---

# Central Portal

[Central Portal](https://central.sonatype.org/register/central-portal/) is Sonatype's new publishing mechanism
that serves as a modern entry point to the [Maven Central](https://central.sonatype.com/) 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](sonatype).
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](https://central.sonatype.com/).
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](https://central.sonatype.com).

8 changes: 5 additions & 3 deletions docs/repos/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Repositories
docs:
- local
- sonatype
- central-portal
- github
---

Expand All @@ -13,6 +14,7 @@ exposed through subclasses of the `DeploySpec` type, so that, for example, a `lo
`LocalDeploySpec` properties.

`MavenDeployer` supports publishing to:
- local directories, to use them as local maven repositories in other projects [[docs](local)]
- Sonatype Nexus repositories, with support for syncing to [Maven Central](https://central.sonatype.org/) [[docs](sonatype)]
- [GitHub Packages](https://docs.github.com/en/packages) [[docs](github)]
- [local directories](local), to use them as local maven repositories in other projects
- Sonatype's [Nexus](sonatype) repositories, with support for syncing OSSRH projects to [Maven Central](https://central.sonatype.org/)
- Sonatype's [Central Portal](central-portal) uploads, a modern entry point for Maven Central
- [GitHub Packages](github)
20 changes: 13 additions & 7 deletions docs/repos/sonatype.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
---
title: Sonatype & Maven Central
title: Nexus & OSSRH
---

# Sonatype & Maven Central
# Nexus & OSSRH

Add a new spec with `sonatypeSpec {}` or `nexusSpec {}`. It adds a mandatory property called `repositoryUrl`, which is the remote URL
Nexus deployments let you upload packages to a remote Sonatype Nexus repository. Notably, these
are commonly used for OSSRH projects to become part of the [Maven Central](https://central.sonatype.com/) repo.

> Sonatype recently devised a new entry point for Maven Central called the [Central Portal](https://central.sonatype.org/register/central-portal/).
> If you are a new publisher or an old publisher who decided to migrate to Central Portal, please [check the docs](central-portal).
Add a new spec with `nexusSpec {}`. It adds a mandatory property called `repositoryUrl`, which is the remote URL
of the sonatype repo. This defaults to `https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/`, one of the
OSSRH urls that can be synced to Maven Central.

Expand All @@ -13,7 +19,7 @@ deployer {
// Common configuration...
project.description.set("Handy tool to publish maven packages in different repositories.")

sonatypeSpec {
nexusSpec {
// Target URL. You can use `ossrh`, `ossrh1`, `ossrhSnapshots`, `ossrhSnapshots1` or your own URL
repositoryUrl.set(ossrh1)

Expand All @@ -27,7 +33,7 @@ deployer {
}

// If needed, you can add other named specs.
sonatypeSpec("snapshot") {
nexusSpec("snapshot") {
repositoryUrl.set(ossrhSnapshots1)
release.version.set("latest-SNAPSHOT")
...
Expand All @@ -37,7 +43,7 @@ deployer {

## Maven Central sync

Sonatype's OSSRH projects are allowed to sync artifacts with the [Maven Central](https://central.sonatype.org/) repository.
Sonatype's OSSRH projects are allowed to sync artifacts with the [Maven Central](https://central.sonatype.com/) repository.
The process is generally tricky, because you have to:

- Build maven packages with a very strict set of rules (for example, signing is mandatory)
Expand All @@ -50,7 +56,7 @@ Deployer streamlines the process so that only the first step is really your resp
First, enable maven central sync using `syncToMavenCentral`:

```kotlin
sonatypeSpec {
nexusSpec {
syncToMavenCentral = true

auth.user = secret("SONATYPE_USER")
Expand Down
10 changes: 5 additions & 5 deletions docs/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ deployer {
release.version = "1.0.0" // our default
...

sonatypeSpec {
nexusSpec {
// release.version is 1.0.0
...
}

sonatypeSpec("snapshot") {
nexusSpec("snapshot") {
// snapshot publishing. Override the default version
release.version = "1.0.0-SNAPSHOT"
...
Expand All @@ -61,11 +61,11 @@ deployer {
## Tasks

For each spec, the plugin will register a gradle task named `deploy<SpecType><SpecName>`. The spec type is either local,
github, or sonatype. The name defaults to `""` but can be configured. In addition, an extra task called `deployAll` will be
github, nexus or centralPortal. The name defaults to `""` but can be configured. In addition, an extra task called `deployAll` will be
generated, running all deployments at once. In the example above, the following tasks are generated:

- `deploySonatype`
- `deploySonatypeSnapshot`
- `deployNexus`
- `deployNexusSnapshot`
- `deployAll`

> **Note**: Use ./gradlew tasks --group='Deployment' to list all deploy tasks.
Expand Down

0 comments on commit b1563fe

Please sign in to comment.