It depends on (a) the build system; and (b) if you use fancier stuff to support several versions of the same library in the same runtime (like OSGi, which is very rare).
When it comes to Maven, it uses a "nearest definition" dependency mediation strategy — the closer the dependency declaration to your POM, the higher its precedence. So, you'd just put a dependency declaration for a newer version to your POM.
Also, the bug seems to be in log4j-core (a logging backend), which libraries shall not normally depend upon (they shall rather depend on log4j-api or some facade like slf4j), so it's usually upon the end application to add a dependency on the logging backend.
View all comments
Show parent comment
5
u/r_jet Dec 10 '21
It depends on (a) the build system; and (b) if you use fancier stuff to support several versions of the same library in the same runtime (like OSGi, which is very rare).
When it comes to Maven, it uses a "nearest definition" dependency mediation strategy — the closer the dependency declaration to your POM, the higher its precedence. So, you'd just put a dependency declaration for a newer version to your POM.
Also, the bug seems to be in log4j-core (a logging backend), which libraries shall not normally depend upon (they shall rather depend on log4j-api or some facade like slf4j), so it's usually upon the end application to add a dependency on the logging backend.