Skip to content

Commit

Permalink
Provide shaded jar with dgraph4j's dependencies (#239)
Browse files Browse the repository at this point in the history
Using the Dgraph4j client in an application that is bound to its own
Netty dependency version like Apache Spark creates conflicts that can
only be resolved by shading Dgraph4j's dependencies.

This releases the shaded jar together with other artifacts.
  • Loading branch information
EnricoMi authored Dec 3, 2024
1 parent d3eac18 commit a8475f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

buildscript {
repositories {
maven {
Expand All @@ -32,6 +34,7 @@ plugins {
id 'com.github.sherter.google-java-format' version '0.9'
id 'base'
id 'maven-publish'
id 'com.gradleup.shadow' version '8.3.2'
}
// Apply the java plugin to add support for Java
apply plugin: 'java'
Expand Down Expand Up @@ -171,6 +174,14 @@ task fatJar(type: Jar) {
with jar
}

tasks.named('shadowJar', ShadowJar) {
enableRelocation true
relocationPrefix "io.dgraph.dgraph4j.shaded"
relocate 'google', 'io.dgraph.dgraph4j.shaded.google'
archiveClassifier.set("shaded")
mergeServiceFiles()
}

task buildJar(type: Jar)

task javadocJar(type: Jar) {
Expand Down Expand Up @@ -201,6 +212,7 @@ task integrationTest(type: Test) {

artifacts {
archives jar
archives shadowJar
archives sourceJar
archives javadocJar
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit a8475f6

Please sign in to comment.