Question

I have a project that has N dependencies that all have a dependency on some library A (say commons-logging) and I want to use some other library B (say jcl-over-slf4j, which is billed as a replacement for commons-logging) as a substitute for that library instead, so that B is always used in every case, and A never gets included in the project at all.

The only way I know to handle this situation is to add B as an explicit dependency, then for each of the N libraries add an exclusion saying not to bring in A. That seems contrary to the spirit of being declarative, not to mention it's insanely repetitive if A is something commonly used (like commons-logging). Is there a way to say, "Whenever anything needs A as a transitive dependency, give it B instead"?

Was it helpful?

Solution

The question of replacing commons-logging with jcl-over-slf4j is discussed in the SLF4J FAQ. I personally find alternative 3), i.e. empty artifacts, quite appealing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top