0

I'm a backend developer who worked in South Korea.

I'm experiencing a mysql dependency conflict.

I want to use two data sources (DB: mysql) in a spring boot project, but the mysql version is different (one is 5.0 and the other is 8.0).

So, I add a dependency like this in build.gradle.

 runtimeOnly("mysql:mysql-connector-java:5.0.4")
 runtimeOnly("mysql:mysql-connector-java:8.0.22")

However, if the group and name are the same, Gradle only supports one dependency.

Who could think like this, the MySQL 8.0 connector can connect to the most recent MySQL version, so I verified that the MySQL 8.0 driver can connect to the most recent MySQL version, which is 5.7.

The other method I discovered is that MySQL 5.0 is connected via mysql-connector-java, and MySQL 8.0 is connected via mariadb-java-client.

But I don`t want to solve this problem like this... This is just makeshift.

Please give me another way. Thank you

In Gradle, how do you install multiple versions of the same dependency? 

Raushan Kumar
  • 1,195
  • 12
  • 21
  • Even if you got that to work in Gradle, how would your programs know what version of the dependency to resolve classes from? Maybe you need to convert one of the JARs to a different namespace, eg as discussed here https://stackoverflow.com/questions/30110421/can-i-somehow-include-and-use-multiple-versions-of-a-given-jar-library – Simon Jacobs Feb 11 '23 at 23:12

0 Answers0