File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11plugins {
2- id ' java-library'
3- id ' idea'
4- id ' maven-publish'
5- id ' signing'
6- id ' com.github.sherter.google-java-format' version ' 0.9'
7- id ' com.google.osdetector' version ' 1.6.0'
2+ id ' java-library'
3+ id ' idea'
4+ id ' maven-publish'
5+ id ' signing'
6+ id ' com.github.sherter.google-java-format' version ' 0.9'
7+ id ' io.github.gradle-nexus.publish-plugin' version ' 2.0.0'
8+ id ' com.google.osdetector' version ' 1.6.0'
89}
910
1011group ' io.tiledb'
1112version ' 0.31.0-SNAPSHOT'
1213
1314repositories {
1415 mavenCentral()
15- maven {
16- url " https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots"
17- }
1816}
1917
2018java {
@@ -238,16 +236,15 @@ publishing {
238236 }
239237 }
240238 }
239+ }
241240
241+ nexusPublishing {
242242 repositories {
243- maven {
244- def releasesRepoUrl = " https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
245- def snapshotsRepoUrl = " https://central.sonatype.com/repository/maven-snapshots/"
246- url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
247- credentials {
248- username System . getenv(' SONATYPE_CENTRAL_USERNAME' )
249- password System . getenv(' SONATYPE_CENTRAL_PASSWORD' )
250- }
243+ sonatype {
244+ nexusUrl. set(uri(" https://ossrh-staging-api.central.sonatype.com/service/local/" ))
245+ snapshotRepositoryUrl. set(uri(" https://central.sonatype.com/repository/maven-snapshots/" ))
246+ username. set(System . getenv(" SONATYPE_CENTRAL_USERNAME" ))
247+ password. set(System . getenv(" SONATYPE_CENTRAL_PASSWORD" ))
251248 }
252249 }
253250}
Original file line number Diff line number Diff line change @@ -5,10 +5,11 @@ echo "Starting upload to maven"
55echo " ${GPG_SECRET_KEYS_ENC} " | base64 --decode > $GPG_KEY_LOCATION
66./gradlew properties -q | grep " version:" | awk ' {print $2}'
77export PROJECT_VERSION=$( ./gradlew properties -q | grep " version:" | awk ' {print $2}' )
8- # Upload only snapshots to sonatype oss so it can make its way to maven central
9- ./gradlew publishMavenJavaPublicationToMavenRepository
108
11- # Only non-snapshot can be pushed as maven releases
9+ # Publish to Sonatype (Central Portal via OSSRH Staging API).
10+ # IMPORTANT: close/release must run in the SAME Gradle invocation so the plugin can reuse the created staging repository id.
1211if [[ ! $( echo " ${PROJECT_VERSION} " | grep " SNAPSHOT" ) ]]; then
13- ./gradlew closeAndReleaseRepository
12+ ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
13+ else
14+ ./gradlew publishToSonatype
1415fi
You can’t perform that action at this time.
0 commit comments