Skip to content

Commit b4325e2

Browse files
authored
Bump dgraph4j and Gradle versions (#139)
Revised build.gradle according to https://central.sonatype.org/pages/gradle.html to fix Maven Central deployment issues.
1 parent 2b82ed4 commit b4325e2

File tree

3 files changed

+28
-83
lines changed

3 files changed

+28
-83
lines changed

PUBLISHING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ ossrhPassword=<…password…>
2626
### Deploying
2727
* Build and test the code that needs to be published.
2828
* Bump version by modifying the `version` variable in `build.gradle` file.
29-
* Test the publish process locally by running `./gradlew publishMavenJavaPublicationToMavenLocal`
30-
* Run `./gradlew publish`.
29+
* Run `./gradlew uploadArchives`.
3130
* Release the deployment by following the steps on the page _Releasing the Deployment_ (link in references below).
3231

3332
### References

build.gradle

Lines changed: 26 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ apply plugin: 'java'
3636
apply plugin: 'com.google.protobuf'
3737
apply plugin: 'idea'
3838
apply plugin: 'com.github.sherter.google-java-format'
39-
apply plugin: 'maven-publish'
39+
apply plugin: 'maven'
4040
apply plugin: 'signing'
4141

4242
group = 'io.dgraph'
4343
archivesBaseName = 'dgraph4j'
44-
version = '2.1.0'
44+
version = '20.03.0'
4545
sourceCompatibility = 1.8
4646
targetCompatibility = 1.8
4747

@@ -196,83 +196,37 @@ if(project.hasProperty("ossrhUsername")) {
196196
sign configurations.archives
197197
}
198198

199-
publishing {
200-
publications {
201-
mavenJava(MavenPublication) {
202-
customizePom(pom)
203-
groupId 'io.dgraph'
204-
artifactId 'dgraph4j'
205-
version "${dgraph4jVersion}"
206-
207-
from components.java
208-
209-
pom.withXml {
210-
def pomFile = file("${project.buildDir}/generated-pom.xml")
211-
writeTo(pomFile)
212-
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
213-
artifact(pomAscFile) {
214-
classifier = null
215-
extension = 'pom.asc'
216-
}
217-
}
199+
uploadArchives {
200+
repositories {
201+
mavenDeployer {
202+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
218203

219-
artifact(sourceJar) {
220-
classifier = 'sources'
204+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
205+
authentication(userName: ossrhUsername, password: ossrhPassword)
221206
}
222207

223-
artifact(javadocJar) {
224-
classifier = 'javadoc'
208+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
209+
authentication(userName: ossrhUsername, password: ossrhPassword)
225210
}
226211

227-
// create the signed artifacts
228-
project.tasks.signArchives.signatureFiles.each {
229-
artifact(it) {
230-
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
231-
if (matcher.find()) {
232-
classifier = matcher.group(1)
233-
} else {
234-
classifier = null
235-
}
236-
extension = 'jar.asc'
237-
}
238-
}
239-
}
240-
}
241-
repositories {
242-
maven {
243-
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
244-
credentials {
245-
username ossrhUsername
246-
password ossrhPassword
247-
}
248-
}
249-
}
250-
}
251-
}
252-
253-
def customizePom(pom) {
254-
pom.withXml {
255-
def root = asNode()
256-
257-
// add all items necessary for maven central publication
258-
root.children().last() + {
259-
resolveStrategy = Closure.DELEGATE_FIRST
260-
261-
description 'Dgraph Java Client'
262-
name 'dgraph4'
263-
url 'https://github.com/dgraph-io/dgraph4'
264-
licenses {
265-
license {
266-
name 'Apache License 2.0'
267-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
268-
distribution 'repo'
269-
}
270-
}
212+
pom.project {
213+
name 'dgraph4j'
214+
packaging 'jar'
215+
artifactId 'dgraph4j'
216+
description 'Dgraph Java Client'
217+
url 'https://github.com/dgraph-io/dgraph4j'
271218

272219
scm {
273220
connection 'https://github.com/dgraph-io/dgraph4j.git'
274-
url 'https://github.com/dgraph-io/dgraph4j'
221+
url 'https://github.com/dgraph-io/dgraph4j'
222+
}
275223

224+
licenses {
225+
license {
226+
name 'Apache License 2.0'
227+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
228+
distribution 'repo'
229+
}
276230
}
277231

278232
developers {
@@ -281,20 +235,12 @@ def customizePom(pom) {
281235
}
282236
}
283237
}
284-
}
285-
model {
286-
tasks.generatePomFileForMavenJavaPublication {
287-
destination = file("$buildDir/generated-pom.xml")
288-
}
289-
tasks.publishMavenJavaPublicationToMavenLocal {
290-
dependsOn project.tasks.signArchives
291-
}
292-
tasks.publishMavenJavaPublicationToMavenRepository {
293-
dependsOn project.tasks.signArchives
294238
}
295239
}
240+
}
296241
}
297242

243+
298244
task version() {
299245
doLast {
300246
println dgraph4jVersion

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

0 commit comments

Comments
 (0)