Legacy build uses log4j, class loading issues


(Markus Perndorfer) #1

Hi!

I’m currently building a PoC for converting our monster of an ant-based build to gradle.

The problem is, there are various custom ant targets / helper classes of the build that use more than the log4j API covered by log4j-over-slf4j (bundled with Gradle) and that leads fun errors like NoClassDefFoundError

Has anybody encountered similar issues and has maybe a quick win solution?

Adding the real log4j jar to the buildscript classpath doesn’t work, looks like log4j-over-slf4j is loaded before

I know that the helper classes should be refactored / rewritten, but I don’t have control over them.


(Schalk Cronjé) #2

A possible solution is to use the worker API with an isolated classloader.