mojohaus / cobertura-maven-plugin

Cobertura Maven Plugin
https://www.mojohaus.org/cobertura-maven-plugin/
25 stars 20 forks source link

Cobertura 2.1.1 uses slf4j binding logback-classic #36

Open nomis opened 7 years ago

nomis commented 7 years ago

Cobertura 2.1.1 uses the slf4j binding logback-classic, which causes problems when the project has a different slf4j binding:

[INFO] --- cobertura-maven-plugin:2.7:instrument (report:cobertura) @ lightswitch-android ---
[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Saved information on 10 classes.
[INFO] Cobertura: Saved information on 10 classes.

[ERROR] SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/mnt/ssd/m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/mnt/ssd/m2/repository/eu/lp0/slf4j/slf4j-android/1.7.12-0/slf4j-android-1.7.12-0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

This binding should be removed, leaving only slf4j-api.

Please DO NOT propose workarounds, those are in the closed issue #6.

nomis commented 7 years ago

I can exclude logback-classic from the cobertura dependency but then I run into other problems because there's then no slf4j binding when the test projects are run.

If I skip the tests it then fails to run on my project because the slf4j binding it uses only works on Android platforms. It looks like Cobertura either needs to stop using slf4j or Maven needs to segregate the plugin dependencies from the project dependencies.

adrshsrvstv commented 6 years ago

Is there any solution to this issue at all?

ct-parker commented 5 years ago

Just to add some context to how important fixing this bug is, there is a StackOverflow question illustrating that Cobertura 2.1.1 forces wire logging for Apache Commons HttpClient, which can easily cripple a Jenkins server.