From c3dabee6d613fd784d726b52c23a49b869fcfbdf Mon Sep 17 00:00:00 2001 From: Matt Domsch Date: Fri, 7 May 2021 09:27:15 -0500 Subject: [PATCH] Gradle magic to publish to Maven Central Signed-off-by: Matt Domsch --- build.gradle | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0c58adc..00a0a4b 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,8 @@ plugins { id 'signing' } +version = '0.2.0-SNAPSHOT' + repositories { mavenCentral() @@ -42,6 +44,8 @@ java { withSourcesJar() } +ext.isReleaseVersion = !version.endsWith("SNAPSHOT") + publishing { publications { model(MavenPublication) { @@ -83,6 +87,15 @@ publishing { name = 'myRepo' url = "file://${buildDir}/repo" } + maven { + def releaseRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + def snapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + url = isReleaseVersion ? releaseRepo : snapshotRepo + credentials { + username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" + password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" + } + } } } @@ -98,6 +111,5 @@ signing { } group = 'com.sailpoint' -version = '0.1.0-SNAPSHOT' sourceCompatibility = 9; targetCompatibility = 9;