0

It' a pretty strange problem. I have a 3rd party jar dependency published in inhouse artifactory. let's name it irresistibility.jar irresistibility.jar jar is fat: it contains some useful classes + com.mycompany.anotherstuff.*

com.mycompany.anotherstuff.* is included into irresistibility.jar fat jar during build and it conflicts with anotherstuff.jar which is also dependency and has up to date com.mycompany.anotherstuff.*

irresistibility.jar and anotherstuff.jar clash in runtime and sometimes outdated classes com.mycompany.anotherstuff.* from irresistibility.jar take over and all goes really bad.

I have NO chance to change irresistibility.jar build. It's just exist. I have no chance to rebuild from sources, it will take the rest of my life (legacy, you know).

Is there any viable option to:

  • exclude classes com.mycompany.anotherstuff.* from irresistibility.jar using gradle when I add irresistibility.jar as dependency

  • do some sort of hack and unzip irresistibility.jar, delete com.mycompany.anotherstuff.* and republish irresistibility.jar as irresistibility-good-stuff.jar without conflicting classes?

Capacytron
  • 3,425
  • 6
  • 47
  • 80
  • you can't [really](https://stackoverflow.com/questions/40883974/gradle-exclude-a-dependencys-package). – Eugene May 06 '21 at 20:26
  • You can try downloading the JAR manually and filtering only what is needed, see [this](https://stackoverflow.com/questions/36473673/how-to-exclude-particular-class-from-a-jar-in-gradle) answer. – Cisco May 07 '21 at 00:33

0 Answers0