Skip to content

Commit 69eac7f

Browse files
authored
Switch to nmcp Gradle plugin for publishing to Maven Central (#5648)
1 parent 06668ba commit 69eac7f

9 files changed

Lines changed: 23 additions & 115 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ jobs:
9999
with:
100100
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
101101
arguments: >-
102-
publishAllPublicationsToMavenCentralSnapshotsRepository -x check
102+
publishAggregationToCentralSnapshots
103103
prepareGitHubAttestation
104+
-x check
104105
- name: Generate build provenance attestations
105106
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
106107
with:

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,9 @@ jobs:
148148
env:
149149
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
150150
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
151-
JRELEASER_MAVENCENTRAL_STAGE: PUBLISH
152-
JRELEASER_MAVENCENTRAL_DEPLOYMENT_ID: ${{ inputs.deploymentId }}
153151
with:
154152
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
155-
arguments: jreleaserDeploy
153+
arguments: nmcpPublishDeployment -PnmcpDeploymentId=${{ inputs.deploymentId }}
156154

157155
publish_documentation:
158156
name: Publish documentation

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- [ ] Change release date in Release Notes
88
- [ ] Change release date in `README.MD`
99
- [ ] Commit with message "Release ${VERSION}"
10-
- [ ] Execute `./gradlew --no-build-cache --no-configuration-cache clean build jreleaserDeploy`
10+
- [ ] Execute `./gradlew --no-build-cache --no-configuration-cache clean build publishAggregationToCentralPortal`
1111
- [ ] Tag current commit: `git tag -s -m ${VERSION} r${VERSION}`
1212
- [ ] Change `version` in `gradle.properties` on release branch to new development versions and commit with message "Back to snapshots for further development" or similar
1313
- [ ] Push release branch and tag to GitHub: `git push --set-upstream --follow-tags origin HEAD`

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ plugins {
55
id("junitbuild.build-metadata")
66
id("junitbuild.checkstyle-nohttp")
77
id("junitbuild.jacoco-aggregation-conventions")
8-
id("junitbuild.maven-central-publishing")
98
id("junitbuild.temp-maven-repo")
109
}
1110

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ download = { id = "de.undercouch.download", version = "5.7.0" }
9999
errorProne = { id = "net.ltgt.errorprone", version = "5.1.0" }
100100
foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "1.0.0" }
101101
jmh = { id = "me.champeau.jmh", version = "0.7.3" }
102-
jreleaser = { id = "org.jreleaser", version = "1.23.0" }
103102
# check if workaround in gradle.properties can be removed when updating
104103
kotlin = { id = "org.jetbrains.kotlin.jvm", version = "2.3.21" }
104+
nmcp-settings = { id = "com.gradleup.nmcp.settings", version = "1.5.0" }
105105
node = { id = "com.github.node-gradle.node", version = "7.1.0" }
106106
nullaway = { id = "net.ltgt.nullaway", version = "3.0.0" }
107107
plantuml = { id = "io.freefair.plantuml", version = "9.5.0" }

gradle/plugins/publishing/build.gradle.kts

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,5 @@ plugins {
66

77
dependencies {
88
implementation("junitbuild.base:dsl-extensions")
9-
implementation(libs.plugins.jreleaser.markerCoordinates)
10-
constraints {
11-
implementation("org.eclipse.jgit:org.eclipse.jgit") {
12-
version {
13-
require("6.10.1.202505221210-r")
14-
}
15-
because("Workaround for CVE-2025-4949")
16-
}
17-
implementation("org.apache.tika:tika-core") {
18-
version {
19-
require("3.2.2")
20-
}
21-
because("Workaround for CVE-2025-66516")
22-
}
23-
implementation("com.fasterxml.jackson.core:jackson-core") {
24-
version {
25-
require("2.21.1")
26-
}
27-
because("Workaround for GHSA-72hv-8253-57qq")
28-
}
29-
implementation("org.codehaus.plexus:plexus-utils") {
30-
version {
31-
require("3.6.1")
32-
}
33-
because("Workaround for CVE-2025-67030")
34-
}
35-
sequenceOf("bcpkix-jdk18on", "bcutil-jdk18on", "bcprov-jdk18on", "bcpg-jdk18on")
36-
.forEach { artifactId ->
37-
implementation("org.bouncycastle:$artifactId") {
38-
version {
39-
require("1.84")
40-
}
41-
because("Workaround for CVE-2026-3505")
42-
}
43-
}
44-
}
9+
implementation(libs.plugins.nmcp.settings.markerCoordinates)
4510
}

gradle/plugins/publishing/src/main/kotlin/junitbuild.maven-central-publishing.gradle.kts

Lines changed: 0 additions & 72 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import kotlin.time.Duration.Companion.minutes
2+
import kotlin.time.toJavaDuration
3+
4+
plugins {
5+
id("com.gradleup.nmcp.settings")
6+
}
7+
8+
nmcpSettings {
9+
centralPortal {
10+
username = providers.gradleProperty("mavenCentralUsername")
11+
password = providers.gradleProperty("mavenCentralPassword")
12+
publishingType = "USER_MANAGED"
13+
validationTimeout = 10.minutes.toJavaDuration()
14+
publishingTimeout = 30.minutes.toJavaDuration()
15+
}
16+
}

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pluginManagement {
99

1010
plugins {
1111
id("junitbuild.build-parameters")
12+
id("junitbuild.maven-central-publishing")
1213
id("junitbuild.settings-conventions")
1314
}
1415

0 commit comments

Comments
 (0)