2

I'm having a quite large gradle project with multiple sub-projects. Problem is that I have clashing dependencies to HikariCP:5.0.1 and HikariCP-java7. I fail to exclude this java7 dependency.

One sub-project "A" includes another sub-project "B". And sub-project "B" has a dependency to quartz scheduler like that:

dependencies {
  api('org.quartz-scheduler:quartz:2.3.2')
}

which gives this dependency tree with B/gradlew -q dependencies --configuration runtimeClasspath:

runtimeClasspath - Runtime classpath of source set 'main'.
+--- ....
+--- org.quartz-scheduler:quartz:2.3.2
|    +--- com.mchange:c3p0:0.9.5.4
|    |    \--- com.mchange:mchange-commons-java:0.2.15
|    +--- com.mchange:mchange-commons-java:0.2.15
|    +--- com.zaxxer:HikariCP-java7:2.4.13
|    |    \--- org.slf4j:slf4j-api:1.7.21 -> 1.7.30

I can exclude this unwanted HikariCP dep:

dependencies {
  api('org.quartz-scheduler:quartz:2.3.2') {
      exclude group: 'com.zaxxer', module: 'HikariCP-java7'
  }
}

which works for that sub-project.

But if I check the dependency tree for the project A it still shows the unwanted java7 version of HikariCP.

dependencies {
  implementation project(':B')
}
|    +--- project :B
|    |    +--- ...
|    |    +--- org.quartz-scheduler:quartz:2.3.2
|    |    |    +--- com.mchange:c3p0:0.9.5.4 -> 0.9.5.5
|    |    |    |    \--- com.mchange:mchange-commons-java:0.2.19
|    |    |    +--- com.mchange:mchange-commons-java:0.2.15 -> 0.2.19
|    |    |    +--- com.zaxxer:HikariCP-java7:2.4.13
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.21 -> 1.7.30

Question: how can I project-wide exclude a certain dependency?

jmizv
  • 1,172
  • 2
  • 11
  • 28
  • found the way from Andy's comment in https://stackoverflow.com/q/67398310/1132056 – Bruce_Wayne May 07 '23 at 13:51
  • Hi @Bruce_Wayne unfortunately I don't have access anymore to the code repository and therefore cannot look up the solution. Sorry! – jmizv May 08 '23 at 06:25

0 Answers0