diff --git a/buildSrc/src/main/kotlin/Publishing.kt b/buildSrc/src/main/kotlin/Publishing.kt index ab82d06c73..3b86b8a221 100644 --- a/buildSrc/src/main/kotlin/Publishing.kt +++ b/buildSrc/src/main/kotlin/Publishing.kt @@ -50,31 +50,25 @@ fun MavenPom.configureMavenCentralMetadata(project: Project) { */ private val spacePublicationEnabled = System.getenv("libs.space.pub")?.equals("true") ?: false -fun mavenRepositoryUri(): URI { +fun configureMavenPublication(rh: RepositoryHandler, project: Project) { if (spacePublicationEnabled) { - return URI("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven") - } - - val repositoryId: String? = System.getenv("libs.repository.id") - return if (repositoryId == null) { - URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - } else { - URI("https://oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId") - } -} + rh.maven { + url = URI("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven") -fun configureMavenPublication(rh: RepositoryHandler, project: Project) { - rh.maven { - url = mavenRepositoryUri() - credentials { - if (spacePublicationEnabled) { + credentials { // Configure space credentials username = project.getSensitiveProperty("libs.space.user") password = project.getSensitiveProperty("libs.space.password") - } else { - // Configure sonatype credentials - username = project.getSensitiveProperty("libs.sonatype.user") - password = project.getSensitiveProperty("libs.sonatype.password") + } + } + } + val centralRepo = project.getSensitiveProperty("libs.repo.url") + if (!centralRepo.isNullOrBlank()) { + rh.maven { + url = URI(centralRepo) + credentials { + username = project.getSensitiveProperty("libs.repo.user") + password = project.getSensitiveProperty("libs.repo.password") } } }