I have a project using Gradle 8, and ran into a bu...
# community-support
r
I have a project using Gradle 8, and ran into a build issue recently. The code uses a library with logging implemented with a newer version of slf4j, using method logger.atInfo(), logger.atWarn() etc. This project compiles fine, and the right version of slf4j dependency was downloaded. However the build complained
java.lang.NoSuchMethodError: 'org.slf4j.spi.LoggingEventBuilder org.slf4j.Logger.atInfo()'
on running test, because Gradle automatically adds gradle-api.jar in the class path, and the jar file contains an older version of slf4j API that doesn't have these methods. Is there a way to exclude gradle-api.jar from the class path? The normal way of excluding transient dependency doesn't work, because nothing depends on gradle-api.jar except gradle itself.
v
So this is a Gradle plugin you are developing?
If yes, Gradle dictates the runtime environment and thus the supported SLF4J version and you cannot use a newer one. If no, then why do you have the
gradle-api.jar
in the test classpath, that does not make too much sense, can you share an MCVE?