0

We have a third party library that transitively pulls in backport-util-concurrent:backport-util-concurrent. We can use Maven to ban that, but the third party library code imports classes from the edu.emory.mathcs.backport.java.util.concurrent package.

Does Java or Maven provide a way to force any edu.emory.mathcs.backport.java.util... import to instead use java.util...? Preferably that substitution could be forced at both compile time and runtime, so that we can be sure the API is being implemented fully enough to be dropped in without obvious breakage.

Brandon
  • 2,367
  • 26
  • 32
  • 2
    Maybe it would help to take a look at maven-shade-plugin https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html ? – khmarbaise Sep 29 '21 at 21:41
  • No direct use of Java/Maven but related: https://stackoverflow.com/q/39742821/3080094 – vanOekel Sep 29 '21 at 22:36
  • Thank you! The `maven-shade-plugin` looks like a good lead, but we're not building shaded JARs right now. In this specific example, we're packaging up the libraries as a WAR. We may ultimately move to shaded JARs in the future. Until then, is there a way to take advantage of the ability to rewrite a library JAR's bytecode while still building WARs? – Brandon Sep 30 '21 at 18:44

0 Answers0