ActiveCampaign / postmark-java

Official Java client library for the Postmark HTTP API
https://postmarkapp.com
MIT License
35 stars 21 forks source link

Version `1.8.2` introduces `slf4j-simple` dependency #44

Closed ivansenic closed 2 years ago

ivansenic commented 2 years ago

Your latest release introduces the org.slf4j:slf4j-simple dependency. I guess this is breaking the usage for majority of the users, due to the slf4j multiple-bindings. For example, all SpringBoot users would not be able to start the app:

Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.SimpleLoggerFactory loaded from file:/home/ise/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.36/a41f9cfe6faafb2eb83a1c7dd2d0dfd844e2a936/slf4j-simple-1.7.36.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.SimpleLoggerFactory

You should only depend on the slf4j api and do not introduce the implementation.

Workaround:

// postmark
implementation("com.wildbit.java:postmark:1.8.+") {
  exclude group: 'org.slf4j', module: 'slf4j-simple'
}
ibalosh commented 2 years ago

I see, thank you for contacting us. The library itself is not using slf4j explicitly, so we could remove the lightweight logger from the dependency list. Then again, with SpringBoot, if we would use other logging framework in future for our library, it could generate multiple binding issue too.

In case you are using SpringBoot, wouldn't there be an option to exclude the dependency on your project side, instead of doing that on the library? This would eliminate the error and it would not break the usage. We could make a change to the library, but we want to make sure that we are adapting it to general java audience, rather than focusing on specific frameworks.

ibalosh commented 2 years ago

Hi @ivansenic

thank you for reporting this, we decided to keep things simple, and remove the dependency. Change is visible in 1.8.3 version, released today.