This sounds to me like a generic problem so I'm wondering if there is a general recommended way to deal with these situations regardless of the build / dependency management tools used (Gradle in my case). I can imagine this issue arising regardless of the build tool, even in a small project where the few dependencies are handled manually and which is simply built with Java using the jar
command.
My Java project uses Velocity 1.7 so it has the Velocity 1.7 JARs in its classpath.
However this project also uses ReportNG, which depends on Velocity 1.4 (it even has the entry Class-Path: velocity-dep-1.4.jar
in its manifest, plus its downloaded zip contains velocity-dep-1.4.jar
and its home page explicitly mentions that velocity-dep-1.4.jar
must be in the classpath).
I'm wondering how to avoid having on my classpath the JARs for both Velocity versions, which is the likely cause of strange behavior I'm seeing and which in any case doesn't sound at all like a good idea.
I'm going to try to make ReportNG use Velocity 1.7 instead of 1.4 but it won't necessarily work and I'd like to avoid doing that if there is a clean way of dealing with these situations.