My library, call it my-util-lib, uses slf4j as the logging facade. I need a concrete slf4j binding at runtime when I use my library directly, but I don't want the binding jar to be 'inherited' when an application imports my-util-lib. I know I can declare the dependency scope as 'test' in the POM of my-util-lib to accomplish this, but then I cannot run my library directly, other than in JUnit tests. Like if I want to run a main() method from one of my util classes for some quick-n-dirty purpose or quick test. Is there a way to accomplish this? Or to force the scope of a run to 'test' when not running a JUnit test?
Set
<scope>provided</scope
on the <dependency>
to slf4j.
For a discussion of the values of scope
, see this question: What's the difference between these Maven dependency scopes: provided/compile/system/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With