@@ -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
5051repositories {
@@ -71,7 +72,7 @@ repositories {
7172
7273group = " org.labkey.api"
7374
74- version = " 6.3 .0-SNAPSHOT"
75+ version = " 6.4 .0-SNAPSHOT"
7576
7677dependencies {
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