[slf4j-user] Fail Silently on NOP implementation

Robert Elliot rob at lidalia.org.uk
Fri Apr 29 08:30:35 UTC 2016


> On 29 Apr 2016, at 00:11, Steven Schlansker <sschlansker at opentable.com> wrote:
> 
> Could you simply declare an "optional" dependency on your implementation of choice?
> 
> This will be present when the JAR is invoked as an application, but will not
> participate in the transitive dependencies inherited when used as a library?
> 
> 

Just tried that - it works fine, so I’ve learnt something new. Good solution!

I’d previously thought that “optional” meant on the compile classpath but not the runtime classpath, but I guess it means on the artefact’s own runtime classpath but not a transitive dependency. So it does exactly what you want if you want your artefact to be both a process and a library. Perfect.


More information about the slf4j-user mailing list