diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9afc147a22e..5d406f0d751 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -746,8 +746,8 @@ deploy_to_sonatype: - when: manual allow_failure: true script: - - 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) - - 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) + - 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) + - 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) - 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) - 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) - ./gradlew -PbuildInfo.build.number=$CI_JOB_ID publishToSonatype closeSonatypeStagingRepository -PskipTests $GRADLE_ARGS diff --git a/build.gradle b/build.gradle index e3ed2543fef..ac0bd29d117 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ plugins { id 'de.thetaphi.forbiddenapis' version '3.8' id 'pl.allegro.tech.build.axion-release' version '1.14.4' - id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'com.gradleup.shadow' version '8.3.6' apply false id 'me.champeau.jmh' version '0.7.0' apply false @@ -92,7 +92,7 @@ nexusPublishing { def forceLocal = project.hasProperty('forceLocal') && forceLocal if (forceLocal && !isCI) { local { - // For testing use with https://hub.docker.com/r/sonatype/nexus + // For testing, use with https://hub.docker.com/r/sonatype/nexus // docker run --rm -d -p 8081:8081 --name nexus sonatype/nexus:oss // ./gradlew publishToLocal // Doesn't work for testing releases though... (due to staging) @@ -103,7 +103,13 @@ nexusPublishing { allowInsecureProtocol = true } } else { + // see https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-central + // For official documentation: + // staging repo publishing https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration + // snapshot publishing https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-via-other-methods sonatype { + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) username = System.getenv("SONATYPE_USERNAME") password = System.getenv("SONATYPE_PASSWORD") } diff --git a/gradle/repositories.gradle b/gradle/repositories.gradle index 41df77fa3b1..34738eacdc9 100644 --- a/gradle/repositories.gradle +++ b/gradle/repositories.gradle @@ -18,7 +18,8 @@ repositories { mavenContent { snapshotsOnly() } - url 'https://oss.sonatype.org/content/repositories/snapshots/' + // see https://central.sonatype.org/publish/publish-portal-snapshots/#consuming-via-gradle + url 'https://central.sonatype.com/repository/maven-snapshots/' } ivy { artifactPattern 'https://sqreen-ci-java.s3.amazonaws.com/jars/[organisation]/[artifact]-[revision](-[classifier]).[ext]'