Skip to content

Commit 3c79334

Browse files
Issue 53059: Use new plugin for publishing using new Maven Central API (#81)
1 parent ffdc19d commit 3c79334

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# The LabKey Remote API Library for Java - Change Log
22

3-
## version 6.3.0-SNAPSHOT
3+
## version 6.4.0-SNAPSHOT
44
*Released*: TBD
5+
*
6+
7+
## version 6.3.0
8+
*Released*: 19 June 2025
59
* Update Commons Codec, Commons Logging, Gradle, Gradle Plugins, HttpClient, HttpCore, and JSONObject versions
610
* Remove defunct FileNotification API and uses
11+
* Update publishing method for new Maven Central API
712

813
## version 6.2.0
914
*Released*: 29 July 2024

build.gradle

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ plugins {
4545
id 'java'
4646
id 'maven-publish'
4747
id 'signing'
48+
id("com.gradleup.nmcp").version("0.1.4") // https://github.com/GradleUp/nmcp
4849
}
4950

5051
repositories {
@@ -71,7 +72,7 @@ repositories {
7172

7273
group = "org.labkey.api"
7374

74-
version = "6.3.0-SNAPSHOT"
75+
version = "6.4.0-SNAPSHOT"
7576

7677
dependencies {
7778
api "org.json:json:${jsonObjectVersion}"
@@ -196,17 +197,6 @@ project.publishing {
196197
}
197198
}
198199
repositories {
199-
if (project.hasProperty("sonatype_staging_url") && project.hasProperty("sonatype_username") && project.hasProperty("sonatype_password"))
200-
{
201-
maven {
202-
url = sonatype_staging_url
203-
credentials {
204-
username = sonatype_username
205-
password = sonatype_password
206-
}
207-
}
208-
}
209-
210200
if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password'))
211201
{
212202
maven {
@@ -242,3 +232,28 @@ if (project.hasProperty("signing.keyId") && project.hasProperty("signing.passwor
242232
}
243233
}
244234

235+
if (project.hasProperty("sonatype_username") && project.hasProperty("sonatype_password"))
236+
{
237+
// Plugin that uses the New Maven Central Publishing (NMCP) API to publish Maven artifacts. https://github.com/GradleUp/nmcp
238+
nmcp {
239+
centralPortal {
240+
username = sonatype_username
241+
password = sonatype_password
242+
// publish manually from the portal
243+
publishingType = "USER_MANAGED"
244+
// // or if you want to publish automatically
245+
// publishingType = "AUTOMATIC"
246+
}
247+
}
248+
}
249+
250+
project.tasks.register('publishRelease', DefaultTask) {
251+
DefaultTask task ->
252+
task.group = 'Publishing'
253+
task.description = 'Publish to Local repository and Maven Central'
254+
if (project.hasProperty("artifactory_user") && project.hasProperty("artifactory_password"))
255+
task.dependsOn(tasks.publish)
256+
if (project.hasProperty("sonatype_username") && project.hasProperty("sonatype_password"))
257+
task.dependsOn(tasks.publishLibsPublicationToCentralPortal)
258+
}
259+

0 commit comments

Comments
 (0)