[slf4j-user] How to deal with conflicts from application servers
Joachim Durchholz
jo at durchholz.org
Wed Oct 26 20:11:22 UTC 2016
Am 26.10.2016 um 19:16 schrieb Robert .:
> How do you deal with this?
Multiple possibilities.
1) Make two artifacts at different Maven coordinates.
2) Make two artifacts at the same Maven coordinate, using classifiers to
distinguish them. This may run into trouble if some Maven plugin does
not know how to handle classifiers - *most* plugins do, but I would be
surprised if all did.
3) Make *three* artifacts: a standalone main program, a WAR artifact,
and a library artifact that contains the common code. The common code
has a compile-scope dependency on SLF4J, that's all.
4) Use the Spring Boot plugin, which can generate a dual-use "fat jar"
which can run standalone or inside a web container. The fat jar contains
a class loader and a logging backend jar, inside a container the backend
is ignored, standalone the backend's classes are added to the classpath.
(Personally, I think that Spring Boot's fat-jar support alone is totally
worth it, even for projects that do not use Spring and to not run inside
a Java container. YMMV.)
HTH
Jo
More information about the slf4j-user
mailing list