@@ -26,8 +26,8 @@ buildscript {
26
26
ext. is_release_version = ! version_name. endsWith(" SNAPSHOT" )
27
27
28
28
repositories {
29
- jcenter()
30
29
google()
30
+ mavenCentral()
31
31
}
32
32
dependencies {
33
33
classpath ' com.android.tools.build:gradle:7.2.2'
@@ -39,7 +39,8 @@ buildscript {
39
39
}
40
40
41
41
plugins {
42
- id " org.jlleitschuh.gradle.ktlint" version " 11.0.0"
42
+ id " org.jlleitschuh.gradle.ktlint" version " 11.0.0"
43
+ id ' io.github.gradle-nexus.publish-plugin' version ' 2.0.0'
43
44
}
44
45
45
46
allprojects {
@@ -52,11 +53,10 @@ allprojects {
52
53
}
53
54
54
55
repositories {
55
- jcenter()
56
56
google()
57
57
mavenCentral()
58
58
// SNAPSHOT support
59
- maven {url " https://oss .sonatype.org/content/repositories/ snapshots/" }
59
+ maven { url " https://central .sonatype.com/repository/maven- snapshots/" }
60
60
maven { url " https://jitpack.io" }
61
61
}
62
62
@@ -117,9 +117,35 @@ task testODPModule () {
117
117
}
118
118
119
119
// Publish to MavenCentral
120
+ nexusPublishing {
121
+ packageGroup = group_id
122
+ repositories {
123
+ sonatype {
124
+ nexusUrl. set(uri(' https://ossrh-staging-api.central.sonatype.com/service/local/' ))
125
+ snapshotRepositoryUrl. set(uri(' https://central.sonatype.com/repository/maven-snapshots/' ))
126
+ username = System . getenv(' MAVEN_CENTRAL_USERNAME' )
127
+ password = System . getenv(' MAVEN_CENTRAL_PASSWORD' )
128
+ }
129
+ }
130
+
131
+ }
120
132
121
133
task ship () {
122
134
dependsOn(' :android-sdk:ship' , ' :shared:ship' , ' :event-handler:ship' , ' :user-profile:ship' , ' :datafile-handler:ship' , ' :odp:ship' )
135
+ doLast {
136
+ def sonatypeTasks = [' publishToSonatype' ]
137
+ if (is_release_version) {
138
+ sonatypeTasks. add(' closeSonatypeStagingRepository' )
139
+ }
140
+
141
+ def args = [' ./gradlew' ]
142
+ args. addAll(sonatypeTasks)
143
+ args. add(' --info' )
144
+
145
+ exec {
146
+ commandLine args
147
+ }
148
+ }
123
149
}
124
150
125
151
def publishedProjects = subprojects. findAll { it. name != ' test-app' }
@@ -223,17 +249,6 @@ configure(publishedProjects) {
223
249
from components. release
224
250
}
225
251
}
226
- repositories {
227
- maven {
228
- def releaseUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
229
- def snapshotUrl = " https://oss.sonatype.org/content/repositories/snapshots"
230
- url = is_release_version ? releaseUrl : snapshotUrl
231
- credentials {
232
- username System . getenv(' MAVEN_CENTRAL_USERNAME' )
233
- password System . getenv(' MAVEN_CENTRAL_PASSWORD' )
234
- }
235
- }
236
- }
237
252
}
238
253
239
254
signing {
0 commit comments