From 23e2e0837280bc965e17927a2214a5dcbd1962bf Mon Sep 17 00:00:00 2001 From: Akom Date: Tue, 25 Jul 2023 08:50:36 -0400 Subject: [PATCH] Switch to gradle nexus publish plugin (3.9) --- build.gradle | 51 +++++++++++++++++++---------------------------- gradle.properties | 2 ++ settings.gradle | 2 +- 3 files changed, 23 insertions(+), 32 deletions(-) diff --git a/build.gradle b/build.gradle index 9190bbd094..ae3f68c071 100644 --- a/build.gradle +++ b/build.gradle @@ -18,8 +18,8 @@ import org.gradle.internal.jvm.Jvm plugins { // This adds tasks to auto close or release nexus staging repos - // see https://github.com/Codearte/gradle-nexus-staging-plugin/ - id 'io.codearte.nexus-staging' + // see https://github.com/gradle-nexus/publish-plugin + id 'io.github.gradle-nexus.publish-plugin' //OWASP Security Vulnerability Detection id 'org.owasp.dependencycheck' // Declare spotbugs at the top @@ -32,39 +32,28 @@ wrapper { distributionType = Wrapper.DistributionType.ALL } -if (deployUrl.contains('nexus')) { - //internal terracotta config, shorten url for this plugin to end at local/ - project.nexusStaging { - serverUrl = deployUrl.replaceAll(~/local\/.*$/, "local/") - packageGroup = 'Ehcache OS' //internal staging repository name - } - ext { - deployUser = tcDeployUser - deployPwd = tcDeployPassword - } -} else { - project.nexusStaging { - packageGroup = 'org.ehcache' //Sonatype staging repository name - } - ext { - deployUser = sonatypeUser - deployPwd = sonatypePwd +nexusPublishing { + repositories { + sonatype { + username = sonatypeUser + password = sonatypePwd + packageGroup = 'org.ehcache' //Sonatype staging repository name + } + nexus { + username = tcDeployUser + password = tcDeployPassword + packageGroup = 'Ehcache OS' //internal staging repository name + nexusUrl.set(uri('https://nexus.terracotta.eur.ad.sag:8443/service/local/')) + snapshotRepositoryUrl.set(uri("https://nexus.terracotta.eur.ad.sag:8443/content/repositories/terracotta-os-snapshots/")) + } } -} - -project.nexusStaging { - username = project.ext.deployUser - password = project.ext.deployPwd - logger.debug("Nexus Staging: Using login ${username} and url ${serverUrl}") // Sonatype is often very slow in these operations: - delayBetweenRetriesInMillis = (findProperty('delayBetweenRetriesInMillis') ?: '10000') as int - numberOfRetries = (findProperty('numberOfRetries') ?: '100') as int + transitionCheckOptions { + delayBetween = Duration.ofSeconds((findProperty('delayBetweenRetriesInSeconds') ?: '10') as int) + maxRetries = (findProperty('numberOfRetries') ?: '100') as int + } } -// Disable automatic promotion for added safety -closeAndReleaseRepository.enabled = false - - ext { baseVersion = findProperty('overrideVersion') ?: ehcacheVersion diff --git a/gradle.properties b/gradle.properties index bf5b0e1083..21c10dd1ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,6 +29,8 @@ jacocoVersion = 0.8.5 sonatypeUser = OVERRIDE_ME sonatypePwd = OVERRIDE_ME +tcDeployUser = OVERRIDE_ME +tcDeployPassword = OVERRIDE_ME deployUrl = https://oss.sonatype.org/service/local/staging/deploy/maven2/ diff --git a/settings.gradle b/settings.gradle index c6f8b0bae6..36791a67b8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,7 +16,7 @@ pluginManagement { plugins { - id 'io.codearte.nexus-staging' version '0.21.1' + id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' id 'com.github.spotbugs' version '4.2.3' id 'org.jayware.osgi-ds' version '0.5.6' id 'org.owasp.dependencycheck' version '5.2.4'