Skip to content

Commit 6f42852

Browse files
committed
use nexus publishing plugin
1 parent 47c8de5 commit 6f42852

File tree

1 file changed

+18
-31
lines changed

1 file changed

+18
-31
lines changed

build.gradle.kts

+18-31
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
`java-library`
88
`maven-publish`
99
signing
10-
id("io.codearte.nexus-staging") version "0.30.0"
10+
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
1111
kotlin("jvm") version "1.9.20"
1212
id("org.jetbrains.dokka") version "1.8.10" // KDoc Documentation Builder
1313
id("com.github.breadmoirai.github-release") version "2.4.1"
@@ -20,10 +20,10 @@ repositories {
2020
dependencies {
2121
implementation("com.squareup.okhttp3:okhttp:4.12.0")
2222

23-
implementation("com.fasterxml.jackson.core:jackson-core:2.15.3")
24-
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.3")
25-
implementation("com.fasterxml.jackson.core:jackson-annotations:2.15.3")
26-
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.3")
23+
implementation("com.fasterxml.jackson.core:jackson-core:2.17.2")
24+
implementation("com.fasterxml.jackson.core:jackson-databind:2.17.2")
25+
implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.2")
26+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2")
2727

2828
implementation("org.slf4j:slf4j-api:2.0.9")
2929

@@ -62,27 +62,24 @@ val sourcesJar by tasks.registering(Jar::class) {
6262
from(sourceSets.main.get().allSource)
6363
}
6464

65-
nexusStaging {
66-
serverUrl = "https://s01.oss.sonatype.org/service/local/"
67-
packageGroup = "com.cjcrafter"
68-
stagingProfileId = findProperty("OSSRH_ID").toString()
69-
username = findProperty("OSSRH_USERNAME").toString()
70-
password = findProperty("OSSRH_PASSWORD").toString()
71-
numberOfRetries = 30
72-
delayBetweenRetriesInMillis = 3000
65+
nexusPublishing {
66+
repositories {
67+
sonatype {
68+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
69+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
70+
username.set(System.getenv("OSSRH_USERNAME") ?: findProperty("OSSRH_USERNAME").toString())
71+
password.set(System.getenv("OSSRH_PASSWORD") ?: findProperty("OSSRH_PASSWORD").toString())
72+
}
73+
}
7374
}
7475

75-
// Signing artifacts
7676
signing {
7777
isRequired = true
78-
//useGpgCmd()
79-
8078
useInMemoryPgpKeys(
81-
findProperty("SIGNING_KEY_ID").toString(),
82-
findProperty("SIGNING_PRIVATE_KEY").toString(),
83-
findProperty("SIGNING_PASSWORD").toString()
79+
System.getenv("SIGNING_KEY_ID") ?: findProperty("SIGNING_KEY_ID").toString(),
80+
System.getenv("SIGNING_PRIVATE_KEY") ?: findProperty("SIGNING_PRIVATE_KEY").toString(),
81+
System.getenv("SIGNING_PASSWORD") ?: findProperty("SIGNING_PASSWORD").toString(),
8482
)
85-
//sign(configurations["archives"])
8683
sign(publishing.publications)
8784
}
8885

@@ -123,20 +120,10 @@ publishing {
123120
}
124121
}
125122
}
126-
127-
repositories {
128-
maven {
129-
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
130-
credentials {
131-
username = findProperty("OSSRH_USERNAME").toString()
132-
password = findProperty("OSSRH_PASSWORD").toString()
133-
}
134-
}
135-
}
136123
}
137124

138125
// After publishing, the nexus plugin will automatically close and release
139-
tasks.named("publish") {
126+
tasks.named("publishToSonatypeRepository") {
140127
finalizedBy("closeAndReleaseRepository", "createGithubRelease")
141128
}
142129

0 commit comments

Comments
 (0)