From 39776bfc1a256b05d8b39329397b953752b843ee Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Sat, 26 Jul 2025 17:00:41 +0200 Subject: [PATCH 1/2] build: publish a shaded version in addition to plain client6 io.grpc uses META-INF/services to dynamically load NameResolver providers. When building a fat JAR, plugins like maven-assembly-plugin won't merge overlapping config files without an additional configuration on the end-user's side. While configuring the plugin is not difficult and we could document this in our README, we will do our users one better: using maven-shade-plugin we can distribute a shaded version of client6 with all its' dependencies' configurations resolved in advance (in addition to the 'slim' version of the lib). Now, when trying to build a fat JAR all that our users will need to do is include all tag to client6 block. --- pom.xml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8576d7044..12c3d52fc 100644 --- a/pom.xml +++ b/pom.xml @@ -217,7 +217,6 @@ io.grpc:protoc-gen-grpc-java:1.58.0:exe:${os.detected.classifier} src/main/java false - @@ -445,6 +444,28 @@ maven-project-info-reports-plugin 3.1.1my + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + false + true + all + + + + + + + package + + shade + + + + @@ -464,6 +485,10 @@ org.codehaus.mojo build-helper-maven-plugin + + org.apache.maven.plugins + maven-shade-plugin + org.apache.maven.plugins maven-javadoc-plugin From 00b44cc9a161faa770fe18ef93a4a01c881ae72e Mon Sep 17 00:00:00 2001 From: dyma solovei <53943884+bevzzz@users.noreply.github.com> Date: Mon, 28 Jul 2025 10:37:56 +0200 Subject: [PATCH 2/2] chore: add a section about uber-JARs to README --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fa12075ab..b4d2ebd41 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Official Weaviate Java Client. ## Usage -To start using Weaviate Java Client add this dependency to `pom.xml`: +To start using Weaviate Java Client add the dependency to `pom.xml`: ```xml @@ -17,11 +17,17 @@ To start using Weaviate Java Client add this dependency to `pom.xml`: ``` -### For applications on Java 9 or above +### Uber JAR🫙 + +If you're building a uber-JAR with something like `maven-assembly-plugin`, use a shaded version with classifier `all`. +This ensures that all dynamically-loaded dependecies of `io.grpc` are resolved correctly. + + +### Gson and reflective access to internal JDK classes The client uses Google's [`gson`](https://github.com/google/gson) for JSON de-/serialization which does reflection on internal `java.lang` classes. This is _not allowed by default_ in Java 9 and above. -To work around this, it's necessary to add this JVM commandline argument: +To work around this, it's necessary to add this JVM command line argument: ``` --add-opens=java.base/java.lang=ALL-UNNAMED