Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
Hi, I have self-written library which I use as javaagent and it has to have logback dependency.
When I run this library as javaagent it must not conflict with target application's logback classes.
I tried to relocate logback and plugin did it.
Everything related to ch.qos.logback.classic now is under 'shadow' directory.
But when I run agent with spring boot executable jar I have error like:
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class shadow.ch.qos.logback.classic.LoggerContext loaded from file:/my-java-agent.jar).
This happens because agent loaded first but when spring boot starts loading it's ClassLoader recognise somehow that my shadow.ch.qos.logback.classic is logback implementation and it is already loaded.
What I need it to hide my logback dependency and use it only if target application does not have it's own.
I'm pretty sure this is related to how slf4j detects implementations on the classpath. There's nothing I can do here. It has nothing to do with shadow or package relocating.
Hi, I have self-written library which I use as javaagent and it has to have logback dependency. When I run this library as javaagent it must not conflict with target application's logback classes. I tried to relocate logback and plugin did it.
relocate 'ch.qos.logback.classic','shadow.ch.qos.logback.classic'
Everything related to ch.qos.logback.classic now is under 'shadow' directory. But when I run agent with spring boot executable jar I have error like:
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class shadow.ch.qos.logback.classic.LoggerContext loaded from file:/my-java-agent.jar).
This happens because agent loaded first but when spring boot starts loading it's ClassLoader recognise somehow that my shadow.ch.qos.logback.classic is logback implementation and it is already loaded.
What I need it to hide my logback dependency and use it only if target application does not have it's own.
Can you advice something please?