From d648165196f7d71efd66e7382ac0f37d72bceea1 Mon Sep 17 00:00:00 2001 From: Olav Loite Date: Tue, 26 Jan 2021 11:32:17 +0100 Subject: [PATCH] feat: support creating shaded jars Some applications that load multiple JDBC drivers may run into dependency conflicts if other JDBC drivers use the same dependencies but different versions. This problem can be mitigated by creating a jar with shaded dependencies. This change adds a Maven profile for creating shaded jars. Fixes #316 --- .readme-partials.yaml | 11 +++++++++++ pom.xml | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/.readme-partials.yaml b/.readme-partials.yaml index 47e65e14..c407ffc2 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -23,3 +23,14 @@ custom_content: | } } ``` + + ### Creating a Shaded Jar + + A jar with all dependencies included is automatically generated when you execute `mvn package`. + The dependencies in this jar are not shaded. To create a jar with shaded dependencies you must + activate the `shade` profile like this: + + ``` + mvn package -Pshade + ``` + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 146c7ee5..23f5c0e1 100644 --- a/pom.xml +++ b/pom.xml @@ -309,6 +309,50 @@ + + + + shade + + + + org.apache.maven.plugins + maven-shade-plugin + + + + com + com.google.cloud.spanner.jdbc.shaded.com + + com.google.cloud.spanner.** + + + + android + com.google.cloud.spanner.jdbc.shaded.android + + + io + com.google.cloud.spanner.jdbc.shaded.io + + io.grpc.netty.shaded.** + + + + org + com.google.cloud.spanner.jdbc.shaded.org + + org.conscrypt.** + + + + + + + + + +