Skip to content

Commit 19abb57

Browse files
committed
build: migrate publishing to Central Publisher Portal via nmcp
s01.oss.sonatype.org now returns HTTP 402 for new publishers. Switch to com.gradleup.nmcp which speaks the new Central Portal REST API. - Add nmcp plugin (0.0.8) to root plugins block - Add nmcp { publishAllProjectsProbablyBreakingProjectIsolation } block with CENTRAL_USERNAME / CENTRAL_PASSWORD env-var support - Remove the retired s01.oss.sonatype.org maven repository block from the shared maven-publish subproject config
1 parent 9f71951 commit 19abb57

1 file changed

Lines changed: 18 additions & 22 deletions

File tree

build.gradle.kts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
plugins {
2+
id("com.gradleup.nmcp") version "0.0.8"
23
id("com.diffplug.spotless") version "6.25.0" apply false
34
}
45

6+
// Publish all subproject maven-publish publications to Maven Central via the
7+
// Central Publisher Portal REST API (replaces the retired s01.oss.sonatype.org
8+
// OSSRH staging endpoint). Credentials are read from CENTRAL_USERNAME /
9+
// CENTRAL_PASSWORD environment variables (or the corresponding Gradle
10+
// properties). publicationType = "AUTOMATIC" auto-releases after upload.
11+
nmcp {
12+
publishAllProjectsProbablyBreakingProjectIsolation {
13+
username = (findProperty("centralUsername") as String?)?.ifBlank { null }
14+
?: System.getenv("CENTRAL_USERNAME")?.ifBlank { null } ?: ""
15+
password = (findProperty("centralPassword") as String?)?.ifBlank { null }
16+
?: System.getenv("CENTRAL_PASSWORD")?.ifBlank { null } ?: ""
17+
publicationType = "AUTOMATIC"
18+
}
19+
}
20+
521
allprojects {
622
group = "dev.arcp"
723
version = "1.0.0-SNAPSHOT"
@@ -87,28 +103,8 @@ subprojects {
87103
}
88104
}
89105
}
90-
91-
// Sonatype Central. Credentials read from gradle.properties or
92-
// ORG_GRADLE_PROJECT_* environment variables; the deploy target
93-
// resolves to the OSS staging endpoint by default and to the
94-
// snapshots repository when `version` carries the SNAPSHOT
95-
// qualifier.
96-
repositories {
97-
maven {
98-
name = "central"
99-
val releases = uri(
100-
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
101-
val snapshots = uri(
102-
"https://s01.oss.sonatype.org/content/repositories/snapshots/")
103-
url = if (version.toString().endsWith("SNAPSHOT")) snapshots else releases
104-
credentials {
105-
username = (findProperty("ossrhUsername") as String?)
106-
?: System.getenv("OSSRH_USERNAME") ?: ""
107-
password = (findProperty("ossrhPassword") as String?)
108-
?: System.getenv("OSSRH_PASSWORD") ?: ""
109-
}
110-
}
111-
}
106+
// No maven repository block here — nmcp handles Central Portal
107+
// upload at the root project level.
112108
}
113109

114110
// Signing is only wired when the developer has supplied a PGP key.

0 commit comments

Comments
 (0)