Skip to content

Commit 045d04c

Browse files
fix(build.gradle): Update Nexus publishing configuration for Sonatype staging repository
1 parent 894f919 commit 045d04c

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

build.gradle

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ plugins {
66
id 'com.github.hierynomus.license' version '0.16.1'
77
id 'com.github.spotbugs' version "6.0.14"
88
id 'maven-publish'
9+
id 'signing'
10+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
911
}
1012

1113
allprojects {
@@ -140,17 +142,17 @@ configure(publishedProjects) {
140142
artifact javadocJar
141143
}
142144
}
143-
repositories {
144-
maven {
145-
def releaseUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
146-
def snapshotUrl = "https://central.sonatype.com/repository/maven-snapshots/"
147-
url = isReleaseVersion ? releaseUrl : snapshotUrl
148-
credentials {
149-
username System.getenv('MAVEN_CENTRAL_USERNAME')
150-
password System.getenv('MAVEN_CENTRAL_PASSWORD')
151-
}
152-
}
153-
}
145+
// repositories {
146+
// maven {
147+
// def releaseUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
148+
// def snapshotUrl = "https://central.sonatype.com/repository/maven-snapshots/"
149+
// url = isReleaseVersion ? releaseUrl : snapshotUrl
150+
// credentials {
151+
// username System.getenv('MAVEN_CENTRAL_USERNAME')
152+
// password System.getenv('MAVEN_CENTRAL_PASSWORD')
153+
// }
154+
// }
155+
// }
154156
}
155157

156158
signing {
@@ -186,7 +188,18 @@ configure(publishedProjects) {
186188
}
187189

188190
task ship() {
189-
dependsOn(':core-api:ship', ':core-httpclient-impl:ship')
191+
dependsOn(':core-httpclient-impl:ship', ':core-api:ship', 'publishToSonatype', 'closeSonatypeStagingRepository')
192+
}
193+
194+
nexusPublishing {
195+
repositories {
196+
sonatype {
197+
nexusUrl.set(uri('https://ossrh-staging-api.central.sonatype.com/service/local/'))
198+
snapshotRepositoryUrl.set(uri('https://central.sonatype.com/repository/maven-snapshots/'))
199+
username = System.getenv('MAVEN_CENTRAL_USERNAME')
200+
password = System.getenv('MAVEN_CENTRAL_PASSWORD')
201+
}
202+
}
190203
}
191204

192205
task jacocoMerge(type: JacocoMerge) {

0 commit comments

Comments
 (0)