Skip to content

Commit 4f8246e

Browse files
authored
Merge pull request #429 from weaviate/v6-shade-for-uber-jar
v6: include a shaded version of client6 in deployment bundle
2 parents 531770e + 00b44cc commit 4f8246e

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Official Weaviate Java Client.
66

77
## Usage
88

9-
To start using Weaviate Java Client add this dependency to `pom.xml`:
9+
To start using Weaviate Java Client add the dependency to `pom.xml`:
1010

1111
```xml
1212

@@ -17,11 +17,17 @@ To start using Weaviate Java Client add this dependency to `pom.xml`:
1717
</dependency>
1818
```
1919

20-
### For applications on Java 9 or above
20+
### Uber JAR🫙
21+
22+
If you're building a uber-JAR with something like `maven-assembly-plugin`, use a shaded version with classifier `all`.
23+
This ensures that all dynamically-loaded dependecies of `io.grpc` are resolved correctly.
24+
25+
26+
### Gson and reflective access to internal JDK classes
2127

2228
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.
2329

24-
To work around this, it's necessary to add this JVM commandline argument:
30+
To work around this, it's necessary to add this JVM command line argument:
2531

2632
```
2733
--add-opens=java.base/java.lang=ALL-UNNAMED

pom.xml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@
216216
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.58.0:exe:${os.detected.classifier}</pluginArtifact>
217217
<outputDirectory>src/main/java</outputDirectory>
218218
<clearOutputDirectory>false</clearOutputDirectory>
219-
220219
</configuration>
221220
<executions>
222221
<execution>
@@ -461,6 +460,28 @@
461460
<artifactId>maven-project-info-reports-plugin</artifactId>
462461
<version>3.1.1my</version>
463462
</plugin>
463+
464+
<plugin>
465+
<groupId>org.apache.maven.plugins</groupId>
466+
<artifactId>maven-shade-plugin</artifactId>
467+
<version>3.6.0</version>
468+
<configuration>
469+
<createDependencyReducedPom>false</createDependencyReducedPom>
470+
<shadedArtifactAttached>true</shadedArtifactAttached>
471+
<shadedClassifierName>all</shadedClassifierName>
472+
<transformers>
473+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
474+
</transformers>
475+
</configuration>
476+
<executions>
477+
<execution>
478+
<phase>package</phase>
479+
<goals>
480+
<goal>shade</goal>
481+
</goals>
482+
</execution>
483+
</executions>
484+
</plugin>
464485
</plugins>
465486
</pluginManagement>
466487
<plugins>
@@ -480,6 +501,10 @@
480501
<groupId>org.codehaus.mojo</groupId>
481502
<artifactId>build-helper-maven-plugin</artifactId>
482503
</plugin>
504+
<plugin>
505+
<groupId>org.apache.maven.plugins</groupId>
506+
<artifactId>maven-shade-plugin</artifactId>
507+
</plugin>
483508
<plugin>
484509
<groupId>org.apache.maven.plugins</groupId>
485510
<artifactId>maven-javadoc-plugin</artifactId>

0 commit comments

Comments
 (0)