Skip to content

Commit 7a24f0b

Browse files
authored
Migrate to Maven Central Publisher Portal (#208)
see junit-team/junit-framework#4483
1 parent f8627a4 commit 7a24f0b

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ jobs:
110110
- shell: bash
111111
env:
112112
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
113-
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
114-
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
113+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
114+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
115115
run: |
116116
./gradlew \
117117
-Porg.gradle.java.installations.auto-download=false \
118118
"-Dscan.value.GitHub job=${{ github.job }}" \
119119
-Dscan.tag.publish \
120120
--scan \
121121
javaToolchains \
122-
publish \
122+
publishAllPublicationsToMavenCentralSnapshotsRepository \
123123
-x check \
124124
--no-configuration-cache

build.gradle.kts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
`maven-publish`
1010
signing
1111
id("com.diffplug.spotless") version "7.0.3"
12-
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
12+
id("com.gradleup.nmcp") version "0.1.4"
1313
}
1414

1515
val javaToolchainVersion = providers.gradleProperty("javaToolchainVersion")
@@ -240,13 +240,6 @@ spotless {
240240
lineEndings = LineEnding.PLATFORM_NATIVE
241241
}
242242

243-
nexusPublishing {
244-
packageGroup.set("org.junit")
245-
repositories {
246-
sonatype()
247-
}
248-
}
249-
250243
publishing {
251244
publications {
252245
create<MavenPublication>("maven") {
@@ -280,6 +273,24 @@ publishing {
280273
}
281274
}
282275
}
276+
repositories {
277+
maven {
278+
name = "mavenCentralSnapshots"
279+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
280+
credentials {
281+
username = providers.gradleProperty("mavenCentralUsername").orNull
282+
password = providers.gradleProperty("mavenCentralPassword").orNull
283+
}
284+
}
285+
}
286+
}
287+
288+
nmcp {
289+
centralPortal {
290+
username = providers.gradleProperty("mavenCentralUsername")
291+
password = providers.gradleProperty("mavenCentralPassword")
292+
publishingType = providers.gradleProperty("mavenCentralPublishingType").orElse("USER_MANAGED")
293+
}
283294
}
284295

285296
signing {

0 commit comments

Comments
 (0)