Skip to content

Commit 90a4810

Browse files
sarahchen6bric3
andauthored
Migrate publishing to Maven Central Portal (#8807) (#9054)
* Update gradle-nexus/publish-plugin version * Update URLs * Run deploy_to_sonatype on this branch commit for now for testing * Change comment url * Update to central portal credentials * Apply suggestion for publishing and consuming snapshots from @bric3 * Apply documentation suggestion from @bric3 * Clean comments * Remove testing of deploy_to_sonatype on this branch --------- Co-authored-by: Brice Dutheil <brice.dutheil@gmail.com>
1 parent cbfd693 commit 90a4810

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,8 @@ deploy_to_sonatype:
729729
- when: manual
730730
allow_failure: true
731731
script:
732-
- export SONATYPE_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.sonatype_username --with-decryption --query "Parameter.Value" --out text)
733-
- export SONATYPE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.sonatype_password --with-decryption --query "Parameter.Value" --out text)
732+
- export SONATYPE_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
733+
- export SONATYPE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
734734
- export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.signing.gpg_private_key --with-decryption --query "Parameter.Value" --out text)
735735
- export GPG_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
736736
- ./gradlew -PbuildInfo.build.number=$CI_JOB_ID publishToSonatype closeSonatypeStagingRepository -PskipTests $GRADLE_ARGS

build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ plugins {
2121
id "de.thetaphi.forbiddenapis" version "3.8"
2222

2323
id 'pl.allegro.tech.build.axion-release' version '1.14.4'
24-
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
24+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
2525

2626
id "com.gradleup.shadow" version "8.3.6" apply false
2727
id "me.champeau.jmh" version "0.7.0" apply false
@@ -88,7 +88,7 @@ nexusPublishing {
8888
def forceLocal = project.hasProperty('forceLocal') && forceLocal
8989
if (forceLocal && !isCI) {
9090
local {
91-
// For testing use with https://hub.docker.com/r/sonatype/nexus
91+
// For testing, use with https://hub.docker.com/r/sonatype/nexus
9292
// docker run --rm -d -p 8081:8081 --name nexus sonatype/nexus:oss
9393
// ./gradlew publishToLocal
9494
// Doesn't work for testing releases though... (due to staging)
@@ -99,7 +99,13 @@ nexusPublishing {
9999
allowInsecureProtocol = true
100100
}
101101
} else {
102+
// see https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-central
103+
// For official documentation:
104+
// staging repo publishing https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
105+
// snapshot publishing https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-via-other-methods
102106
sonatype {
107+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
108+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
103109
username = System.getenv("SONATYPE_USERNAME")
104110
password = System.getenv("SONATYPE_PASSWORD")
105111
}

gradle/repositories.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ repositories {
1818
mavenContent {
1919
snapshotsOnly()
2020
}
21-
url 'https://oss.sonatype.org/content/repositories/snapshots/'
21+
// see https://central.sonatype.org/publish/publish-portal-snapshots/#consuming-via-gradle
22+
url 'https://central.sonatype.com/repository/maven-snapshots/'
2223
}
2324
ivy {
2425
artifactPattern 'https://sqreen-ci-java.s3.amazonaws.com/jars/[organisation]/[artifact]-[revision](-[classifier]).[ext]'

0 commit comments

Comments
 (0)