@@ -22,13 +22,25 @@ plugins {
2222
2323 id(" com.diffplug.spotless" )
2424 id(" com.github.jk1.dependency-license-report" )
25+ id(" io.github.gradle-nexus.publish-plugin" )
2526 id(" nebula.release" )
2627}
2728
2829release {
2930 defaultVersionStrategy = Strategies .getSNAPSHOT()
3031}
3132
33+ nexusPublishing {
34+ repositories {
35+ sonatype {
36+ nexusUrl.set(uri(" https://aws.oss.sonatype.org/service/local/staging/deploy/maven2" ))
37+ snapshotRepositoryUrl.set(uri(" https://aws.oss.sonatype.org/content/repositories/snapshots/" ))
38+ username.set(System .getenv(" PUBLISH_USERNAME" ))
39+ password.set(System .getenv(" PUBLISH_PASSWORD" ))
40+ }
41+ }
42+ }
43+
3244val releaseTask = tasks.named(" release" )
3345val postReleaseTask = tasks.named(" release" )
3446
@@ -126,10 +138,12 @@ allprojects {
126138 plugins.withId(" maven-publish" ) {
127139 plugins.apply (" signing" )
128140
129- val publishTask = tasks.named(" publish" )
141+ afterEvaluate {
142+ val publishTask = tasks.named(" publishToSonatype" )
130143
131- postReleaseTask.configure {
132- dependsOn(publishTask)
144+ postReleaseTask.configure {
145+ dependsOn(publishTask)
146+ }
133147 }
134148
135149 configure<PublishingExtension > {
@@ -187,22 +201,6 @@ allprojects {
187201 }
188202 }
189203 }
190-
191- val isSnapshot = version.toString().endsWith(" SNAPSHOT" )
192-
193- repositories {
194- maven {
195- name = " Sonatype"
196- url = uri(
197- if (isSnapshot) " https://aws.oss.sonatype.org/content/repositories/snapshots/"
198- else " https://aws.oss.sonatype.org/service/local/staging/deploy/maven2"
199- )
200- credentials {
201- username = System .getenv(" PUBLISH_USERNAME" )
202- password = System .getenv(" PUBLISH_PASSWORD" )
203- }
204- }
205- }
206204 }
207205
208206 tasks.withType<Sign >().configureEach {
0 commit comments