Skip to content

Commit

Permalink
chore: update build file
Browse files Browse the repository at this point in the history
  • Loading branch information
mohnoor94 committed Sep 12, 2024
1 parent 531a84e commit 2cca962
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions code/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,6 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}

def mavenRepository(name, url) {
return {
maven {
name = name
url = uri(url)
credentials {
username = System.getenv("SONATYPE_USERNAME") ?: findProperty('ARTIFACTORY_USER')
password = System.getenv("SONATYPE_PASSWORD") ?: findProperty('ARTIFACTORY_PASS')
}
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down Expand Up @@ -100,12 +87,18 @@ publishing {
}

repositories {
if (project.version.contains("SNAPSHOT")) {
println("Publishing to Sonatype Snapshots: $project.version")
mavenRepository("oss-sonatype-snapshots", "https://oss.sonatype.org/content/repositories/snapshots")()
} else {
println("Publishing to Sonatype Releases: $project.version")
mavenRepository("oss-sonatype-releases", "https://oss.sonatype.org/service/local/staging/deploy/maven2/")()
maven {
if (project.version.contains("SNAPSHOT")) {
name = "oss-sonatype-snapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
} else {
name = "oss-sonatype-releases"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
}
credentials {
username = System.getenv("SONATYPE_USERNAME") ?: findProperty('ARTIFACTORY_USER')
password = System.getenv("SONATYPE_PASSWORD") ?: findProperty('ARTIFACTORY_PASS')
}
}
}
}
Expand Down

0 comments on commit 2cca962

Please sign in to comment.