2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/dev/gradle-2.9/lib/gradle-core-2.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/leo.j.lin/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.5.11/14e29085f65a2e4e0f16e708f4135be122be562e/slf4j-simple-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Failed to instantiate SLF4J LoggerFactory

I have included these as my dependencies. When I run the build, the above error occurs. When I don't have the slf4j-simple dependency, the build will simply failed with error of "Failed to instantiate SLF4J LoggerFactory"

    compile "org.slf4j:slf4j-api:1.5.11"
    compile "org.slf4j:slf4j-simple:1.5.11"

How do I fix this problem?

I have tried Class path contains multiple SLF4J bindings with Gradle, but it does not work for me.

EDIT:

This is the root project build.gradle

buildscript{

}

allprojects{

repositories {

    mavenCentral()
    mavenLocal()
    maven {
        url "https://repo.adobe.com/nexus/content/groups/public/"
    }
}

apply plugin: 'java'

dependencies{
    compile "org.osgi:org.osgi.core:4.2.0"
    compile "org.osgi:org.osgi.compendium:4.2.0"
    compile "org.apache.felix:org.apache.felix.scr.annotations:1.9.6"
    compile "biz.aQute:bndlib:1.50.0"
    compile "javax.servlet:servlet-api:2.5"
    compile "javax.jcr:jcr:2.0"
    compile "org.apache.sling:org.apache.sling.api:2.4.0"
    compile "org.apache.sling:org.apache.sling.jcr.api:2.1.0"
    compile "junit:junit:4.8.2"
    compile "com.day.cq:cq-tagging:5.6.4"
    compile "commons-logging:commons-logging:1.1.1"
    compile "org.apache.commons:commons-lang3:3.0.1"
    compile "com.day.commons.osgi.wrapper:com.day.commons.osgi.wrapper.commons-httpclient:3.1.0.018"
    compile "org.apache.sling:org.apache.sling.jcr.resource:2.2.9-R1523266"
    compile "org.apache.felix:org.apache.felix.scr:1.6.0"
    compile "com.adobe.aem:aem-api:6.0.0.1"
    compile "org.apache.sling:org.apache.sling.models.api:1.0.0"
    compile "javax.servlet.jsp:jsp-api:2.1"
    compile "com.day.cq.wcm:cq-wcm-taglib:5.7.4"
    compile "org.mockito:mockito-all:1.9.5"
    compile "junit-addons:junit-addons:1.4"
}

}

This is the subproject's build.gradle

    buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "http://dl.bintray.com/twcable/aem"
        }
    }

    dependencies {
        classpath "com.twcable.gradle:gradle-plugin-cq-bundle:2.0.0"
        classpath "com.twcable.gradle:gradle-plugin-scr:1.0.1"

    }

}

apply plugin: "com.twcable.cq-bundle"
apply plugin: 'com.twcable.scr'

dependencies {
    compile "org.apache.commons:commons-io:1.3.2"
    compile "org.apache.commons:commons-lang3:3.0.1"
    compile "javax.servlet.jsp:jsp-api:2.2"
    compile "org.apache.sling:org.apache.sling.commons.json:2.0.10"
    compile "com.day.cq:cq-commons:5.8.2"
    compile "org.json:json:20151123"
    compile "com.day.cq.wcm:cq-wcm-api:5.7.2"
    compile "com.day.cq:cq-tagging:5.6.4"
    compile "org.apache.httpcomponents:httpcore:4.3.3"
    compile "org.apache.httpcomponents:httpclient:4.3.3"
    compile "com.adobe.granite:com.adobe.granite.fragment.xml:0.1.0"
    compile "commons-beanutils:commons-beanutils:1.9.2"
    compile "commons-digester:commons-digester:2.1"
    compile "commons-collections:commons-collections:3.2.2"
    compile "xpp3:xpp3:1.1.4c"
    compile "com.day.cq:cq-search:5.6.4"
    compile "cglib:cglib:3.2.0"
    compile "org.apache:jackrabbit-ocm:2.0.0"
    compile "org.jibx:jibx-run:1.2.6"
    compile "com.day.cq.dam:cq-dam-api:5.6.6"
    compile "com.adobe.granite:com.adobe.granite.replication.core:5.5.38"
    compile "com.day.cq.workflow:cq-workflow-api:5.6.2"
    compile "org.apache.sling:org.apache.sling.commons.osgi:2.2.2"
    compile "com.day.cq.dam:cq-dam-commons:5.8.2"
    compile "com.day.commons:day-commons-gfx:2.1.8"
    compile "org.apache.sling:org.apache.sling.commons.mime:2.1.8"
}

The error is from executing the task from this plugin :

apply plugin: 'com.twcable.scr'

The plugin is on github: https://github.com/TWCable/gradle-plugin-scr

Community
  • 1
  • 1
Leo Lin
  • 95
  • 1
  • 10
  • 1
    Gradle shouldn't be including its own dependencies into your project. Can you provide the relevant parts of the `build.gradle`? – mattbdean Dec 29 '15 at 16:08
  • @thatJavaNerd My build.gradle is empty except for the dependencies. I haven not added any custom code to it. It seems like Gradle adds the slf4j to the classpath, because one of the binding it finds is from the Gradle installation. Is it not? – Leo Lin Dec 29 '15 at 16:17
  • @thatJavaNerd The weird thing is if I don't add my own slf4j-simple, it simply cannot find any binding, why doesn't it just use the "internal" one. – Leo Lin Dec 29 '15 at 16:19
  • please show your full build.gradle – RaGe Dec 29 '15 at 16:26
  • @RaGe Edited on the question. – Leo Lin Dec 29 '15 at 16:35
  • 1
    This seems to be a problem with the plugin. – Henry Dec 29 '15 at 16:53

1 Answers1

2

There is an issue filed in the plugin issue-tracker for discussion: https://github.com/TWCable/gradle-plugin-scr/issues/1

Jim Moore
  • 46
  • 3