I am using Gradle catalogue and added the following dependency in my build.gradle
(groovy)
mockserver-client = { module = "org.mock-server:mockserver-client-java-no-dependencies", version = "5.14.0" }
and add dependency on
testImplementation(libs.mockserver.client)
However, I get the following error
LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from file:/Users/XYZ/.gradle/caches/modules-2/files-2.1/org.mock-server/mockserver-client-java-no-dependencies/5.14.0/14d667cc7a345ccb9e3ccae229bd42f67f48b258/mockserver-client-java-no-dependencies-5.14.0.jar).
I understand that I need to exclude sl4j-api
which is transitively imported from mockserver-client-java-no-dependencies
. However following produce no difference
testImplementation(libs.mockserver.client) {
exclude group: 'org.slf4j', module: 'sl4j-api'
}
Similarly, transitive = false
has been useless, too. I can use configurations.configureEach {
as I need sl4j-api
in other configuration.
How could I exclude the said dependency? Also mockserver-client-java-no-dependencies
shows no dependencies in the IntelliJ but is visible in the error message.
So I figured the following is happening
org.mock-server:mockserver-client-java-no-dependencies
declares no dependency but packages them all together in a fat jar.Solution
Import org.mock-server:mockserver-client-java
instead and use transitive=false