On Mon, Aug 15, 2016 at 2:37 AM Michael Osipov <[email protected]> wrote:
> Am 2016-08-14 um 23:21 schrieb Christopher: > > On Sun, Aug 14, 2016 at 4:31 PM Michael Osipov <[email protected]> > wrote: > > > >> Am 2016-08-12 um 23:48 schrieb Christopher: > >>> Hi, > >>> > >>> I use a plugin which has a runtime dependency on an slf4j > implementation, > >>> but the plugin itself is built without declaring one in its pom. ( > >>> https://github.com/koraktor/mavanagaiata/issues/43) > >>> > >>> In some versions of Maven, I get a warning about slf4j not finding an > >>> implementation. In other versions, it is silent. > >>> > >>> Was an slf4j implementation provided in newer versions to the execution > >> of > >>> plugins? > >>> > >>> Will there be a multiple-binding conflict if the plugin itself provides > >> one > >>> of its own to get rid of the warning on certain versions of maven which > >>> result in that warning (I didn't see one when I tried)? > >>> > >>> If there is a risk of a conflict, which implementation would be > preferred > >>> in order to converge on one provided by Maven? > >>> > >>> Is there another solution the plugin should seek? > >>> > >>> In general, what dependencies are plugins expected to provide, and what > >>> dependencies are expected to be provided by Maven, and how are > conflicts > >>> resolved in the architecture? > >>> > >>> Feel free to comment on the GitHub issue directly, or here. I'll be > >>> watching both. > >> > >> I will cite what I have written on Stack Overflow > >> (http://stackoverflow.com/a/7107934/696632) five years ago and it still > >> holds true: > >> > >> You *never* provide a log implementation. The client application has to > >> do so. Otherwhise this would be a violation of separation of concerns. > >> Don't do any assumptions about an unknown client. > >> > >> > > I agree with that sentiment...generally. But this is a maven plugin, so > I'm > > trying to figure out what Maven is going to provide it when it executes. > If > > it's not going to provide an implementation, then the plugin has to. If > you > > have answers to the specific questions I asked above, I think it might > help. > > It should not matter to you what Maven provides. It will always provide > some backend. Otherwise Maven won't be able to log itself. Even if > Maven would not provide anything. It is not your task to force some > implementation. It is a several failure of the client to do so. > > Michael > That would make more sense to me if there were a universally agreed upon logging API, and all clients were guaranteed to provide *some* backend for that standard logging API. Unfortunately, no logging API seems to be universal, and the one provided in Java itself is awful. I'm not even sure what Maven uses underneath, and it may not use SLF4J at all (which means it has no reason to provide an implementation). This is actually a pretty unfortunate circumstance in the first place... Maven plugins should only be logging to the provided Maven logger itself, and the plugin shouldn't care what backend Maven is using for that logger. This particular plugin is doing the right thing... using the Maven logger and relying on Maven for the backend. Unfortunately, it seems the org.eclipse.jgit dependency does its own logging, and that's outside this plugin's control. Until there is a universal logging framework, these heuristics about what the "right" thing to do are not going to be perfect. Ideals like "rely on the client to provide the implementation" aren't going to fully match reality. Personally, I'd like to see an slf4j-like API make its way into Java itself. Then, perhaps these kinds of issues wouldn't come up as often.
