1+ import com.vanniktech.maven.publish.JavaLibrary
2+ import com.vanniktech.maven.publish.JavadocJar
3+
14buildscript {
25 repositories {
36 mavenCentral()
@@ -15,7 +18,7 @@ plugins {
1518 // TODO: Requires Java 11
1619 // id 'com.diffplug.spotless' version '6.25.0'
1720 id ' com.github.nbaztec.coveralls-jacoco' version ' 1.2.20'
18- id ' io.github.gradle-nexus .publish-plugin ' version ' 1.3 .0'
21+ id ' com.vanniktech.maven .publish' version ' 0.34 .0'
1922}
2023
2124group = ' com.uber'
@@ -117,75 +120,46 @@ sourcesJar {
117120 dependsOn buildH3
118121}
119122
120- publishing {
121- publications {
122- mavenJava(MavenPublication ) {
123- from components. java
124- pom {
125- name = ' h3'
126- url = ' https://github.com/uber/h3-java'
127- description = project. description
128- licenses {
129- license {
130- name = ' Apache License, Version 2.0'
131- url = ' https://www.apache.org/licenses/LICENSE-2.0.txt'
132- distribution = ' repo'
133- }
134- }
135- organization {
136- name = ' Uber Open Source'
137- url = ' https://github.com/uber/'
138- }
139- scm {
140- connection = ' scm:git:git://github.com/uber/h3-java.git'
141- developerConnection
= ' scm:git:ssh://[email protected] /uber/h3-java.git' 142- url = ' http://github.com/uber/h3-java/tree/master'
143- }
144- developers {
145- developer {
146- id = ' isaacbrodsky'
147- name = ' Isaac Brodsky'
148- 149- organization = ' Uber Technologies, Inc.'
150- organizationUrl = ' https://github.com/uber/'
151- }
152- }
153- }
154- }
155- }
123+ mavenPublishing {
124+ coordinates(project. group, " h3" , project. version)
156125
157- // repositories {
158- // maven {
159- // def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
160- // def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
161- // url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
162- // credentials {
163- // username = project.findProperty('ossrhUsername') ?: ''
164- // password = project.findProperty('ossrhPassword') ?: ''
165- // }
166- // }
167- // }
168- }
169-
170- signing {
171- // Use in-memory PGP signing keys from environment variables
172- useInMemoryPgpKeys(
173- System . getenv(" SIGNING_KEY_ID" ), // PGP key ID (short format) – optional, can be null
174- System . getenv(" SIGNING_KEY" ), // PGP secret key (ASCII-armored, e.g. base64-encoded)
175- System . getenv(" SIGNING_PASSWORD" ) // PGP key passphrase
176- )
177- sign(publishing. publications) // Sign all publications
178- }
179-
180- nexusPublishing {
181- repositories {
182- sonatype {
183- // Performance optimization, not needed:
184- // stagingProfileId.set(System.getenv("OSSRH_STAGING_PROFILE_ID"))
185- username. set(System . getenv(" OSSRH_USERNAME" ))
186- password. set(System . getenv(" OSSRH_PASSWORD" ))
187- nexusUrl. set(uri(" https://ossrh-staging-api.central.sonatype.com/service/local/" ))
188- snapshotRepositoryUrl. set(uri(" https://central.sonatype.com/repository/maven-snapshots/" ))
189- }
126+ pom {
127+ name = " h3"
128+ description = project. description
129+ url = " https://github.com/uber/h3-java"
130+ licenses {
131+ license {
132+ name = " The Apache License, Version 2.0"
133+ url = " http://www.apache.org/licenses/LICENSE-2.0.txt"
134+ distribution = " http://www.apache.org/licenses/LICENSE-2.0.txt"
135+ }
136+ }
137+ organization {
138+ name = ' Uber Open Source'
139+ url = ' https://github.com/uber/'
140+ }
141+ developers {
142+ developer {
143+ id = " isaacbrodsky"
144+ name = " Isaac Brodsky"
145+ 146+ }
190147 }
148+ scm {
149+ url = " http://github.com/uber/h3-java/tree/master"
150+ connection = " scm:git:git://github.com/uber/h3-java.git"
151+ developerConnection
= " scm:git:ssh://[email protected] /uber/h3-java.git" 152+ }
153+ }
154+
155+ // the first parameter configures the -javadoc artifact, possible values:
156+ // - `JavadocJar.None()` don't publish this artifact
157+ // - `JavadocJar.Empty()` publish an empty jar
158+ // - `JavadocJar.Javadoc()` to publish standard javadocs
159+ // the second whether to publish a sources jar
160+ configure(new JavaLibrary (new JavadocJar.Javadoc (), true ))
161+
162+ publishToMavenCentral()
163+
164+ signAllPublications()
191165}
0 commit comments