maven-mvnd
maven-mvnd copied to clipboard
Cannot use Maven plugins that use slf4j-log4j12
If you try to use mvnd with a maven plugin that uses slf4j-log4j12, the build fails with
java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
at org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)
due to the presence of log4j-over-slf4j in the daemon classloader.
If I build a version of the daemon without the log4j-over-slf4j-dependency, everything seems to work fine, so that might be an easy fix, but it might be there for a reason?
Could you please name and example of a plugin using slf4j-log4j12?
I wasn't able to find any public maven plugins that uses slf4j-log4j12 (ran through the first 20 pages of https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12/usages without spotting anything that looked like a maven plugin), but we have an internal project that uses three of them.
I can probably get the dependency removed from them, so the issue is not critical (well, even the use of mvndaemon is just a quality of life improvement), but I wanted to at least log the issue if anyone else ran into the same problem.
Could be related to https://github.com/mvndaemon/mvnd/issues/183
Yes, certainly your suggestion about isolating the classloaders (https://github.com/mvndaemon/mvnd/issues/183#issuecomment-775922833 ) would fix this issue as well.
@rasmusfaber does that actually work well with stock maven ?
Yes, the build works perfectly with stock maven.