0

Today I finally got around to dealing with the well known annoying errors associated with running Maven Builds inside Eclipse:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

This has been discussed multiple times on Stack Overflow, notably here, and many other questions asked on Stack Overflow about this are made to point to this page.

But here is a new wrinkle. It turns out that those errors were masking another problem. Now, every time I do a build in Maven in Eclipse, every goal invocation shows up with this sort of junk in the log:

15:21:28.984 [main] DEBUG Sisu - Add publisher: com.google.inject.internal.InjectorImpl@169c6f2

-----[explicit bindings]-------------------------------------------------------
0. ProviderInstanceBinding{key=Key[type=com.google.inject.Injector, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Injector>}
1. ProviderInstanceBinding{key=Key[type=java.util.logging.Logger, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Logger>}
2. ProviderInstanceBinding{key=Key[type=org.slf4j.Logger, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<org.slf4j.Logger>}
3. InstanceBinding{key=Key[type=com.google.inject.Stage, annotation=[none]], source=[unknown source], instance=DEVELOPMENT}
4. InstanceBinding{key=Key[type=org.codehaus.plexus.context.Context, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:800), instance={plexus=org.codehaus.plexus.DefaultPlexusContainer@1359c1b}}
5. InstanceBinding{key=Key[type=java.util.Map, annotation=@org.sonatype.inject.Parameters], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:801), instance=null}
6. InstanceBinding{key=Key[type=org.sonatype.guice.bean.locators.MutableBeanLocator, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:803), instance=org.sonatype.guice.bean.locators.DefaultBeanLocator@93d6bc[Locked by thread main]}
7. InstanceBinding{key=Key[type=org.sonatype.guice.plexus.config.PlexusBeanLocator, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:804), instance=org.sonatype.guice.plexus.locators.DefaultPlexusBeanLocator@1f6df4c}
8. InstanceBinding{key=Key[type=org.sonatype.guice.plexus.binders.PlexusBeanManager, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:805), instance=org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager@be0e27}
9. LinkedKeyBinding{key=Key[type=org.codehaus.plexus.PlexusContainer, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:807), scope=Scopes.NO_SCOPE, target=Key[type=org.codehaus.plexus.MutablePlexusContainer, annotation=[none]]}
10. LinkedKeyBinding{key=Key[type=org.codehaus.plexus.MutablePlexusContainer, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:808), scope=Scopes.NO_SCOPE, target=Key[type=org.codehaus.plexus.DefaultPlexusContainer, annotation=[none]]}
11. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.DefaultPlexusContainer, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:811), scope=Scopes.NO_SCOPE, provider=of(org.codehaus.plexus.DefaultPlexusContainer@1359c1b)}
12. ProviderInstanceBinding{key=Key[type=org.apache.maven.plugin.Mojo, annotation=@com.google.inject.name.Named(value=org.apache.maven.plugins:maven-install-plugin:2.3.1:help)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.NO_SCOPE, provider=Loaded class org.apache.maven.plugin.install.HelpMojo from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
13. ProviderInstanceBinding{key=Key[type=org.apache.maven.plugin.Mojo, annotation=@com.google.inject.name.Named(value=org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.NO_SCOPE, provider=Loaded class org.apache.maven.plugin.install.InstallFileMojo from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
14. ProviderInstanceBinding{key=Key[type=org.apache.maven.plugin.Mojo, annotation=@com.google.inject.name.Named(value=org.apache.maven.plugins:maven-install-plugin:2.3.1:install)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.NO_SCOPE, provider=Loaded class org.apache.maven.plugin.install.InstallMojo from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
15. InstanceBinding{key=Key[type=org.sonatype.guice.bean.reflect.ClassSpace, annotation=[none]], source=org.sonatype.guice.plexus.binders.PlexusXmlBeanModule.configure(PlexusXmlBeanModule.java:82), instance=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
16. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.digest.Digester, annotation=@com.google.inject.name.Named(value=sha1)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.SINGLETON, provider=Deferred org.codehaus.plexus.digest.Sha1Digester from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
17. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.digest.StreamingDigester, annotation=@com.google.inject.name.Named(value=sha1)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.SINGLETON, provider=Deferred org.codehaus.plexus.digest.StreamingSha1Digester from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
18. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.digest.StreamingDigester, annotation=@com.google.inject.name.Named(value=md5)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.SINGLETON, provider=Deferred org.codehaus.plexus.digest.StreamingMd5Digester from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
19. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.digest.Digester, annotation=@com.google.inject.name.Named(value=md5)], source=ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36], scope=Scopes.SINGLETON, provider=Deferred org.codehaus.plexus.digest.Md5Digester from ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.3.1, parent: sun.misc.Launcher$AppClassLoader@35ce36]}
20. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.logging.LoggerManager, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$DefaultsModule.configure(DefaultPlexusContainer.java:826), scope=Scopes.NO_SCOPE, provider=org.codehaus.plexus.DefaultPlexusContainer$LoggerManagerProvider@170888e}
21. ProviderInstanceBinding{key=Key[type=org.codehaus.plexus.logging.Logger, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$DefaultsModule.configure(DefaultPlexusContainer.java:827), scope=Scopes.NO_SCOPE, provider=org.codehaus.plexus.DefaultPlexusContainer$LoggerProvider@11563ff}
22. InstanceBinding{key=Key[type=org.sonatype.guice.bean.locators.RankingFunction, annotation=@com.google.inject.name.Named(value=plexus)], source=org.codehaus.plexus.DefaultPlexusContainer$DefaultsModule.configure(DefaultPlexusContainer.java:831), instance=org.sonatype.guice.bean.locators.DefaultRankingFunction@187e184}
23. LinkedKeyBinding{key=Key[type=org.sonatype.guice.bean.locators.RankingFunction, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$DefaultsModule.configure(DefaultPlexusContainer.java:832), scope=Scopes.NO_SCOPE, target=Key[type=org.sonatype.guice.bean.locators.RankingFunction, annotation=@com.google.inject.name.Named(value=plexus)]}
24. InstanceBinding{key=Key[type=org.sonatype.guice.plexus.config.PlexusBeanConverter, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$DefaultsModule.configure(DefaultPlexusContainer.java:836), instance=org.sonatype.guice.plexus.converters.PlexusXmlBeanConverter@1f06dc3}
-----[implicit bindings]-------------------------------------------------------
-------------------------------------------------------------------------------

What is this and why am I seeing it? Evidently, it has something to do with the Google Guice framework. However, none of my code uses this framework, and in this project that I am building, only maven-supplied plugins are used. So, exactly who is injecting this dependency and where? How do I find this? Could it be that some Eclipse plugin I have running is dependent on Guice, and why does this affect a maven build?

One more point of note: running this same build under command-line maven (v 3.2.1), not the Eclipse embedded maven, and the Eclipse Version is Kepler.

Update: please note before commenting:

1. The Maven debug output switch -X is not used when this output occurs.

2. This does not happen using Maven outside of Eclipse.

Community
  • 1
  • 1
Steve Cohen
  • 4,679
  • 9
  • 51
  • 89
  • 2
    That doesn't look like "junk". It looks like the logger in question is set to `DEBUG` and is printing out the debug information as requested. – chrylis -cautiouslyoptimistic- Apr 08 '15 at 21:06
  • What logger? This is a maven build. I specified nothing that I know of in my maven settings that would turn this on. Debug logging (the -X switch) is not used. – Steve Cohen Apr 08 '15 at 21:10
  • 1
    Both Eclipse itself and Maven use Guice internally. This message is from Maven by all appearances. – Tavian Barnes Apr 08 '15 at 21:37
  • @TavianBarnes I would agree with you. But where do you configure debug output for a build? -X is the only way I know, but this code is not in Maven, it's in Guice. Does everyone who "correctly" configures Eclipse for slf4j have to put up with this? Remember, this all started with getting rid of warnings in Eclipse. Seems like there is a bug somewhere but I can't believe there hasn't been more written about it if that is the case. – Steve Cohen Apr 08 '15 at 21:52

1 Answers1

1

This does not happen, even in Eclipse Kepler, if you run using an External Maven such as version 3.2.1. Kepler ships with embedded Maven 3.0.4. So this appears to be a bug that was fixed in some intervening version of Maven. Presumably this goes away with the next Eclipse version, Luna, though I haven't tried it.

Steve Cohen
  • 4,679
  • 9
  • 51
  • 89