Skip to content

Commit dfc216b

Browse files
committed
Filter databricks-jdbc jar to remove embedded slf4j classes
Signed-off-by: jorgee <[email protected]>
1 parent 709632e commit dfc216b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

plugins/nf-sqldb/build.gradle

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ repositories {
3939
configurations {
4040
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies
4141
runtimeClasspath.exclude group: 'org.slf4j', module: 'slf4j-api'
42+
embeddedJar
4243
}
4344

4445
sourceSets {
@@ -55,6 +56,8 @@ ext{
5556
}
5657

5758
dependencies {
59+
embeddedJar 'com.databricks:databricks-jdbc:0.9.8-oss'
60+
5861
compileOnly "io.nextflow:nextflow:$nextflowVersion"
5962
compileOnly 'org.slf4j:slf4j-api:2.0.7'
6063
compileOnly 'org.pf4j:pf4j:3.12.0'
@@ -66,8 +69,8 @@ dependencies {
6669
api 'org.postgresql:postgresql:42.7.4'
6770
api 'org.xerial:sqlite-jdbc:3.47.0.0'
6871
api 'org.duckdb:duckdb_jdbc:0.10.2'
69-
api('com.databricks:databricks-jdbc:0.9.8-oss') { exclude group: 'commons-logging' }
7072

73+
api files("$buildDir/filteredJars/databricks-jdbc-filtered-0.9.8-oss.jar")
7174

7275
// JDBC driver setup for AWS Athena - the 3rd party JAR are being downloaded and setup as gradle tasks below.
7376
// Reference https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html
@@ -129,5 +132,20 @@ task copyAthenDep(dependsOn: unzipAthenDep, type: Copy) {
129132
from file(new File(buildDir, '/downloads/unzip/awsathena/SimbaAthenaJDBC-2.0.25.1001/AthenaJDBC42_2.0.25.1001.jar'))
130133
into "src/dist/lib"
131134
}
135+
136+
// Task to create a filtered JAR
137+
task filteredJar(type: Jar) {
138+
from {
139+
zipTree(configurations.embeddedJar.singleFile).matching {
140+
exclude 'org/slf4j/**' // Exclude SLF4J classes
141+
}
142+
}
143+
archiveBaseName.set("databricks-jdbc-filtered")
144+
archiveVersion.set("0.9.8-oss")
145+
destinationDirectory.set(file("$buildDir/filteredJars"))
146+
}
147+
132148
project.copyPluginLibs.dependsOn('copyAthenDep')
133149
project.compileGroovy.dependsOn('copyAthenDep')
150+
project.compileGroovy.dependsOn('filteredJar')
151+
project.copyPluginLibs.dependsOn('filteredJar')

0 commit comments

Comments
 (0)