I have the following build.gradle in my project
plugins {
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.oracle.database.jdbc:ojdbc11-production:21.3.0.0'
implementation 'com.microsoft.sqlserver:mssql-jdbc:9.4.0.jre8'
}
tasks.named('jar') {
setDuplicatesStrategy(DuplicatesStrategy.WARN)
manifest {
attributes 'Main-Class': 'com.example.App'
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
File META-INF/services/java.sql.Driver
is present in both of imported jars. Actually this Oracle JDBC dependency imports multiple jars and they have more conflicting files (with differing contents) among themselves (e.g. META-INF/native-image/native-image.properties
and others in this directory).
when DuplicatesStrategy is set to WARN, the Oracle driver overwrites SQL Server JDBC driver's META-INF/services/java.sql.Driver
. What are the consequences of this (and others) file being overwritten?
How should I handle these duplicate files? Is there any way to have all files from all jars? The chance of jar getting some of its files overwritten makes me feel uneasy.
Are conflicting files common?