Skip to content

Commit e029502

Browse files
authored
Migrate away from Sonatype OSSRH (#479)
Migrate to the Publisher API through a community plugin, vanniktech/gradle-maven-publish-plugin. #### References - https://central.sonatype.org/pages/ossrh-eol/ - https://cookbook.gradle.org/integrations/maven-central/publishing/#choosing-a-plugin-for-maven-central-publishing
1 parent 1dede3c commit e029502

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

build-logic/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ dependencies {
3232
implementation(libs.kotlin.binary.compatibility.validator.plugin)
3333
implementation(libs.dokka.plugin)
3434
implementation(libs.openapi.generator.plugin)
35+
implementation(libs.vanniktech.mavenPublishPlugin)
3536
"functionalTestImplementation"(project)
3637
}

build-logic/src/main/kotlin/com/gabrielfeo/published-kotlin-jvm-library.gradle.kts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
`java-library`
1010
`maven-publish`
1111
signing
12+
id("com.vanniktech.maven.publish.base")
1213
id("org.jetbrains.kotlinx.binary-compatibility-validator")
1314
id("org.jetbrains.dokka")
1415
}
@@ -47,23 +48,8 @@ tasks.named<Jar>("javadocJar") {
4748
from(tasks.dokkaHtml)
4849
}
4950

50-
publishing {
51-
repositories {
52-
maven {
53-
name = "mavenCentral"
54-
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
55-
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
56-
val isSnapshot = version.toString().endsWith("SNAPSHOT")
57-
url = if (isSnapshot) snapshotsRepoUrl else releasesRepoUrl
58-
authentication {
59-
register<BasicAuthentication>("basic")
60-
}
61-
credentials {
62-
username = project.properties["maven.central.username"] as String?
63-
password = project.properties["maven.central.password"] as String?
64-
}
65-
}
66-
}
51+
mavenPublishing {
52+
publishToMavenCentral()
6753
}
6854

6955
fun isCI() = System.getenv("CI").toBoolean()

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ kotlin-binary-compatibility-validator = "0.18.1"
1313
slf4j = "2.0.17"
1414
logback = "1.5.18"
1515
guava = "33.4.8-jre"
16+
maven-publish-plugin = "0.34.0"
1617

1718
[libraries]
1819
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
@@ -39,3 +40,4 @@ slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
3940
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
4041
logback-core = { module = "ch.qos.logback:logback-core", version.ref = "logback" }
4142
guava = { module = "com.google.guava:guava", version.ref = "guava" }
43+
vanniktech-mavenPublishPlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "maven-publish-plugin" }

0 commit comments

Comments
 (0)