From fcf2532528f183f6377390f569f85d0e8ade848c Mon Sep 17 00:00:00 2001 From: Alan Cai Date: Thu, 18 Jul 2024 11:07:14 -0700 Subject: [PATCH] try top-level nexus publishing --- buildSrc/build.gradle.kts | 23 +++++++++++++++++++ .../gradle/plugin/publish/PublishPlugin.kt | 11 --------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5e57cc0d9..db930ca88 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,3 +1,5 @@ +import java.time.Duration + /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * @@ -16,12 +18,31 @@ plugins { `kotlin-dsl` id("java-gradle-plugin") + id("io.github.gradle-nexus.publish-plugin") version "1.3.0" } repositories { gradlePluginPortal() } +nexusPublishing { + // Documentation for this plugin, see https://github.com/gradle-nexus/publish-plugin/blob/v1.3.0/README.md + this.repositories { + sonatype { + nexusUrl.set(uri("https://aws.oss.sonatype.org/service/local/")) + // For CI environments, the username and password should be stored in + // ORG_GRADLE_PROJECT_sonatypeUsername and ORG_GRADLE_PROJECT_sonatypePassword respectively. + username.set(properties["ossrhUsername"].toString()) + password.set(properties["ossrhPassword"].toString()) + } + } + + // these are not strictly required. The default timeouts are set to 1 minute. But Sonatype can be really slow. + // If you get the error "java.net.SocketTimeoutException: timeout", these lines will help. + connectTimeout = Duration.ofMinutes(3) + clientTimeout = Duration.ofMinutes(3) +} + object Versions { const val detekt = "1.20.0-RC2" const val dokka = "1.6.10" @@ -49,6 +70,8 @@ dependencies { implementation(Plugins.shadow) } + + allprojects { group = rootProject.properties["group"] as String version = rootProject.properties["version"] as String diff --git a/buildSrc/src/main/kotlin/org/partiql/gradle/plugin/publish/PublishPlugin.kt b/buildSrc/src/main/kotlin/org/partiql/gradle/plugin/publish/PublishPlugin.kt index c14bce0d9..f0a7bcb69 100644 --- a/buildSrc/src/main/kotlin/org/partiql/gradle/plugin/publish/PublishPlugin.kt +++ b/buildSrc/src/main/kotlin/org/partiql/gradle/plugin/publish/PublishPlugin.kt @@ -160,17 +160,6 @@ abstract class PublishPlugin : Plugin { } } } - repositories { - maven { - url = uri("https://aws.oss.sonatype.org/service/local/") - credentials { - val ossrhUsername: String by rootProject - val ossrhPassword: String by rootProject - username = ossrhUsername - password = ossrhPassword - } - } - } } // Sign only if publishing to Maven Central