Skip to content

Commit 93a4f32

Browse files
authored
Including custom shadowJar (without ext dependencies)
We're adding a custom task to the `build.gradle` file to allow a customized shadowJar build (uber JAR) that does not contain external dependencies such as org.apache.http, etc.
1 parent 0df94d6 commit 93a4f32

File tree

1 file changed

+64
-30
lines changed

1 file changed

+64
-30
lines changed

integration/spark/build.gradle

+64-30
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,58 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
4747
from javadoc.destinationDir
4848
}
4949

50+
task shadowJarWithoutExternalDependencies(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
51+
archiveClassifier.set('without-external-dependencies')
52+
configurations = [project.configurations.runtimeClasspath]
53+
minimize() {
54+
exclude(project(path: ":app"))
55+
exclude(project(path: ":shared", configuration: activeRuntimeElementsConfiguration))
56+
exclude(project(path: ":spark2"))
57+
exclude(project(path: ":spark3", configuration: activeRuntimeElementsConfiguration))
58+
exclude(project(path: ":spark31"))
59+
exclude(project(path: ":spark32", configuration: activeRuntimeElementsConfiguration))
60+
exclude(project(path: ":spark33", configuration: activeRuntimeElementsConfiguration))
61+
exclude(project(path: ":spark34", configuration: activeRuntimeElementsConfiguration))
62+
exclude(project(path: ":spark35", configuration: activeRuntimeElementsConfiguration))
63+
exclude(project(path: ":snowflake"))
64+
}
65+
66+
dependencies {
67+
exclude(dependency("org.slf4j::"))
68+
exclude("org/apache/commons/logging/**")
69+
exclude("io/openlineage/server/**")
70+
exclude("io/openlineage/sql/libopenlineage_sql_java_x86_64.so")
71+
exclude("io/openlineage/sql/libopenlineage_sql_java_aarch64.so")
72+
exclude("io/openlineage/sql/libopenlineage_sql_java_arm64.dylib")
73+
exclude("com/fasterxml/jackson/**")
74+
exclude("org/apache/http/**")
75+
exclude("org/apache/httpcomponents/client5/**")
76+
exclude("com/github/ok2c/hc5/**")
77+
exclude("org/apache/hc/**")
78+
exclude("org/HdrHistogram/**")
79+
exclude("org/LatencyUtils/**")
80+
exclude("org/apache/commons/codec/**")
81+
exclude("org/apache/commons/lang3/**")
82+
exclude("org/apache/commons/beanutils/**")
83+
exclude("org/yaml/snakeyaml/**")
84+
exclude("javassist/**")
85+
exclude("io/micrometer/**")
86+
exclude("mozilla/**")
87+
exclude("org/publicsuffix/**")
88+
}
89+
90+
manifest {
91+
attributes(
92+
"Created-By": "Gradle ${gradle.gradleVersion}",
93+
"Built-By": System.getProperty("user.name"),
94+
"Build-Jdk": System.getProperty("java.version"),
95+
"Implementation-Title": project.name,
96+
"Implementation-Version": project.version
97+
)
98+
}
99+
zip64 true
100+
}
101+
50102
javadoc {
51103
options.tags = ["apiNote"]
52104
}
@@ -168,38 +220,20 @@ shadowJar {
168220
exclude(dependency("org.slf4j::"))
169221
exclude("org/apache/commons/logging/**")
170222
exclude("io/openlineage/server/**")
171-
exclude("io/openlineage/sql/libopenlineage_sql_java_x86_64.so")
172-
exclude("io/openlineage/sql/libopenlineage_sql_java_aarch64.so")
173-
exclude("io/openlineage/sql/libopenlineage_sql_java_arm64.dylib")
174-
exclude("com/fasterxml/jackson/**")
175-
exclude("org/apache/http/**")
176-
exclude("org/apache/httpcomponents/client5/**")
177-
exclude("com/github/ok2c/hc5/**")
178-
exclude("org/apache/hc/**")
179-
exclude("org/HdrHistogram/**")
180-
exclude("org/LatencyUtils/**")
181-
exclude("org/apache/commons/codec/**")
182-
exclude("org/apache/commons/lang3/**")
183-
exclude("org/apache/commons/beanutils/**")
184-
exclude("org/yaml/snakeyaml/**")
185-
exclude("javassist/**")
186-
exclude("io/micrometer/**")
187-
exclude("mozilla/**")
188-
exclude("org/publicsuffix/**")
189223
}
190224

191-
// relocate "com.github.ok2c.hc5", "io.openlineage.spark.shaded.com.github.ok2c.hc5"
192-
// relocate "org.apache.httpcomponents.client5", "io.openlineage.spark.shaded.org.apache.httpcomponents.client5"
193-
// relocate "javassist", "io.openlineage.spark.shaded.javassist"
194-
// relocate "org.apache.hc", "io.openlineage.spark.shaded.org.apache.hc"
195-
// relocate "org.apache.commons.codec", "io.openlineage.spark.shaded.org.apache.commons.codec"
196-
// relocate "org.apache.commons.lang3", "io.openlineage.spark.shaded.org.apache.commons.lang3"
197-
// relocate "org.apache.commons.beanutils", "io.openlineage.spark.shaded.org.apache.commons.beanutils"
198-
// relocate "org.apache.http", "io.openlineage.spark.shaded.org.apache.http"
199-
// relocate 'org.yaml.snakeyaml', 'io.openlineage.spark.shaded.org.yaml.snakeyaml'
200-
// relocate "com.fasterxml.jackson", "io.openlineage.spark.shaded.com.fasterxml.jackson"
201-
// relocate "org.LatencyUtils", "io.openlineage.spark.shaded.org.latencyutils"
202-
// relocate "org.HdrHistogram", "io.openlineage.spark.shaded.org.hdrhistogram"
225+
relocate "com.github.ok2c.hc5", "io.openlineage.spark.shaded.com.github.ok2c.hc5"
226+
relocate "org.apache.httpcomponents.client5", "io.openlineage.spark.shaded.org.apache.httpcomponents.client5"
227+
relocate "javassist", "io.openlineage.spark.shaded.javassist"
228+
relocate "org.apache.hc", "io.openlineage.spark.shaded.org.apache.hc"
229+
relocate "org.apache.commons.codec", "io.openlineage.spark.shaded.org.apache.commons.codec"
230+
relocate "org.apache.commons.lang3", "io.openlineage.spark.shaded.org.apache.commons.lang3"
231+
relocate "org.apache.commons.beanutils", "io.openlineage.spark.shaded.org.apache.commons.beanutils"
232+
relocate "org.apache.http", "io.openlineage.spark.shaded.org.apache.http"
233+
relocate 'org.yaml.snakeyaml', 'io.openlineage.spark.shaded.org.yaml.snakeyaml'
234+
relocate "com.fasterxml.jackson", "io.openlineage.spark.shaded.com.fasterxml.jackson"
235+
relocate "org.LatencyUtils", "io.openlineage.spark.shaded.org.latencyutils"
236+
relocate "org.HdrHistogram", "io.openlineage.spark.shaded.org.hdrhistogram"
203237
manifest {
204238
attributes(
205239
"Created-By": "Gradle ${gradle.gradleVersion}",

0 commit comments

Comments
 (0)