@@ -26,8 +26,8 @@ buildscript {
2626 ext. is_release_version = ! version_name. endsWith(" SNAPSHOT" )
2727
2828 repositories {
29- jcenter()
3029 google()
30+ mavenCentral()
3131 }
3232 dependencies {
3333 classpath ' com.android.tools.build:gradle:7.2.2'
@@ -39,7 +39,8 @@ buildscript {
3939}
4040
4141plugins {
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'
4344}
4445
4546allprojects {
@@ -52,11 +53,10 @@ allprojects {
5253 }
5354
5455 repositories {
55- jcenter()
5656 google()
5757 mavenCentral()
5858 // SNAPSHOT support
59- maven {url " https://oss .sonatype.org/content/repositories/ snapshots/" }
59+ maven { url " https://central .sonatype.com/repository/maven- snapshots/" }
6060 maven { url " https://jitpack.io" }
6161 }
6262
@@ -117,9 +117,35 @@ task testODPModule () {
117117}
118118
119119// 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+ }
120132
121133task ship () {
122134 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+ }
123149}
124150
125151def publishedProjects = subprojects. findAll { it. name != ' test-app' }
@@ -223,17 +249,6 @@ configure(publishedProjects) {
223249 from components. release
224250 }
225251 }
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- }
237252 }
238253
239254 signing {
0 commit comments