Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide shaded jar with dgraph4j's dependencies #239

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

EnricoMi
Copy link
Contributor

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.

Please release the shaded jar together with your other artifacts.

@EnricoMi EnricoMi requested a review from a team as a code owner September 23, 2024 07:42
@EnricoMi
Copy link
Contributor Author

@EnricoMi
Copy link
Contributor Author

EnricoMi commented Oct 1, 2024

@ryanfoxtyler Is this something Dgraph can provide?

rarvikar
rarvikar previously approved these changes Oct 22, 2024
tasks.named('shadowJar', ShadowJar) {
enableRelocation true
relocationPrefix "io.dgraph.dgraph4j.shaded"
relocate 'google', 'io.dgraph.dgraph4j.shaded.google'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mangalaman93 looks like only those classes that're in the google package are being relocated to a new namespace. So by shading only specific dependencies and not the classes in the main dgraph4j package, we should be able to maintain compatibility with existing projects as well as have a smaller jar file-size, as already noted on Discuss.
Also, should we finalize dgrap4j-shaded as the official name for the shaded version for release ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ShadowJar relocates all dependencies, but for some reason it does not automatically relocate the google package. Only with this line it also includes that package.

Classes in the io.dgraph.dgraph4j are not relocated, only dependencies.

I'd recommend to use the classifier (e.g. shaded):

implementation "io.dgraph:dgraph4j-all:24.0.0:shaded"

rather than giving it a new archive name / artifact name:

implementation "io.dgraph:dgraph4j-shaded:24.0.0"

as this better describes of what jar this is the shaded variant.

@mangalaman93 mangalaman93 merged commit a8475f6 into dgraph-io:master Dec 3, 2024
4 checks passed
@mangalaman93
Copy link
Contributor

Thank you for the PR @EnricoMi

@EnricoMi EnricoMi deleted the shaded branch December 3, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants