@@ -22,13 +22,25 @@ plugins {
22
22
23
23
id(" com.diffplug.spotless" )
24
24
id(" com.github.jk1.dependency-license-report" )
25
+ id(" io.github.gradle-nexus.publish-plugin" )
25
26
id(" nebula.release" )
26
27
}
27
28
28
29
release {
29
30
defaultVersionStrategy = Strategies .getSNAPSHOT()
30
31
}
31
32
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
+
32
44
val releaseTask = tasks.named(" release" )
33
45
val postReleaseTask = tasks.named(" release" )
34
46
@@ -126,10 +138,12 @@ allprojects {
126
138
plugins.withId(" maven-publish" ) {
127
139
plugins.apply (" signing" )
128
140
129
- val publishTask = tasks.named(" publish" )
141
+ afterEvaluate {
142
+ val publishTask = tasks.named(" publishToSonatype" )
130
143
131
- postReleaseTask.configure {
132
- dependsOn(publishTask)
144
+ postReleaseTask.configure {
145
+ dependsOn(publishTask)
146
+ }
133
147
}
134
148
135
149
configure<PublishingExtension > {
@@ -187,22 +201,6 @@ allprojects {
187
201
}
188
202
}
189
203
}
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
- }
206
204
}
207
205
208
206
tasks.withType<Sign >().configureEach {
0 commit comments