Skip to content

Commit

Permalink
try top-level nexus publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Jul 18, 2024
1 parent 06228f0 commit fcf2532
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
23 changes: 23 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.time.Duration

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
Expand All @@ -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"
Expand Down Expand Up @@ -49,6 +70,8 @@ dependencies {
implementation(Plugins.shadow)
}



allprojects {
group = rootProject.properties["group"] as String
version = rootProject.properties["version"] as String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,6 @@ abstract class PublishPlugin : Plugin<Project> {
}
}
}
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
Expand Down

0 comments on commit fcf2532

Please sign in to comment.