0

I am working on a spring boot Gradle application that has a dependency on spring-ldap. The issue is, I need to use our firm's custom dependency for ldap operation which has an older spring-ldap version bundled in it: org.springframework.ldap:spring-ldap-core:1.3.0.RELEASE but the spring-boot dependency comes with the newer version: org.springframework.ldap:spring-ldap-core:2.3.3.RELEASE.

By default Gradle promotes to the newer version of the dependency but even If I force to use any one from these dependency versions, it is throwing runtime MethodNotFound exception at a different location as both dependencies have different method names which are being used by both parent dependencies.

It seems that I need both dependencies in order to run the application and use them from different parent dependencies like:

  1. Spring boot autoconfigure -> spring-ldap-core:2.3.3.RELEASE
  2. Firm's dependency -> spring-ldap-core:1.3.2.RELEASE

What is the best available solution for this?

Chintan Patel
  • 729
  • 3
  • 14
  • 31
  • I often utilize shadowjar's relocation to solve this kind of problems. This is the answer I wrote for the other similar question: https://stackoverflow.com/a/68630823/876595. Hope it could give you some ideas. – chehsunliu Sep 07 '21 at 17:57
  • I checked your solution, but in my case, both spring-ldap dependency classes are called from, third party dependency classes (spring-boot and firm's dependency) I can change the way they are calling the spring ldap methods. – Chintan Patel Sep 07 '21 at 18:15
  • You could, for example, put `spring-ldap-core:1.3.2.RELEASE` and `firm` into a project, and then relocate `spring-ldap-core:1.3.2.RELEASE`. Then the import paths inside `firm` will be changed, too. – chehsunliu Sep 07 '21 at 18:21

0 Answers0