无法将log4j集成到spring-boot中 - 类路径包含多个SLF4J绑定

时间:2015-03-24 15:57:38

标签: spring logging log4j spring-boot

我有多模块gradle项目(常用,web,批处理,调度程序) 这是我的gradle依赖树:

Project :web - web
------------------------------------------------------------

compile - Compile classpath for source set 'main'.
+--- org.springframework.boot:spring-boot-starter-actuator:1.2.2.RELEASE
|    +--- org.springframework.boot:spring-boot-starter:1.2.2.RELEASE
|    |    +--- org.springframework.boot:spring-boot:1.2.2.RELEASE
|    |    |    +--- org.springframework:spring-core:4.1.5.RELEASE
|    |    |    |    \--- commons-logging:commons-logging:1.2
|    |    |    \--- org.springframework:spring-context:4.1.5.RELEASE
|    |    |         +--- org.springframework:spring-aop:4.1.5.RELEASE
|    |    |         |    +--- aopalliance:aopalliance:1.0
|    |    |         |    +--- org.springframework:spring-beans:4.1.5.RELEASE
|    |    |         |    |    \--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |         |    \--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |         +--- org.springframework:spring-beans:4.1.5.RELEASE (*)
|    |    |         +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |         \--- org.springframework:spring-expression:4.1.5.RELEASE
|    |    |              \--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-autoconfigure:1.2.2.RELEASE
|    |    |    +--- org.springframework.boot:spring-boot:1.2.2.RELEASE (*)
|    |    |    \--- org.yaml:snakeyaml:1.14
|    |    +--- org.springframework.boot:spring-boot-starter-logging:1.2.2.RELEASE
|    |    |    +--- org.slf4j:jcl-over-slf4j:1.7.10
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.10
|    |    |    +--- org.slf4j:jul-to-slf4j:1.7.10
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.10
|    |    |    +--- org.slf4j:log4j-over-slf4j:1.7.10
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.10
|    |    |    \--- mycompany:logback-classic:1.1.2
|    |    |         +--- mycompany:logback-core:1.1.2
|    |    |         \--- org.slf4j:slf4j-api:1.7.6 -> 1.7.10
|    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    \--- org.yaml:snakeyaml:1.14
|    +--- org.springframework.boot:spring-boot-actuator:1.2.2.RELEASE
|    |    +--- org.springframework.boot:spring-boot:1.2.2.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-autoconfigure:1.2.2.RELEASE (*)
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.4.5
|    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0
|    |    |    \--- com.fasterxml.jackson.core:jackson-core:2.4.5
|    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    \--- org.springframework:spring-context:4.1.5.RELEASE (*)
|    \--- org.springframework:spring-core:4.1.5.RELEASE (*)
+--- project :common
|    +--- obsidian:obsidian:3.0
|    +--- joda-time:joda-time:2.7
|    +--- org.apache.httpcomponents:httpmime:4.4
|    |    \--- org.apache.httpcomponents:httpclient:4.4
|    |         +--- org.apache.httpcomponents:httpcore:4.4
|    |         +--- commons-logging:commons-logging:1.2
|    |         \--- commons-codec:commons-codec:1.9
|    +--- org.apache.httpcomponents:httpclient:4.4 (*)
|    +--- com.google.code.gson:gson:2.3.1
|    +--- net.sf.opencsv:opencsv:2.3
|    +--- org.springframework:spring-jms:4.1.4.RELEASE
|    |    +--- org.springframework:spring-aop:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-beans:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-core:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-messaging:4.1.4.RELEASE
|    |    |    +--- org.springframework:spring-beans:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-core:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    \--- org.springframework:spring-tx:4.1.4.RELEASE -> 4.1.5.RELEASE
|    |         +--- org.springframework:spring-beans:4.1.5.RELEASE (*)
|    |         \--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    +--- org.springframework.boot:spring-boot-starter-web:1.2.2.RELEASE
|    |    +--- org.springframework.boot:spring-boot-starter:1.2.2.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-starter-tomcat:1.2.2.RELEASE
|    |    |    +--- org.apache.tomcat.embed:tomcat-embed-core:8.0.20
|    |    |    +--- org.apache.tomcat.embed:tomcat-embed-el:8.0.20
|    |    |    +--- org.apache.tomcat.embed:tomcat-embed-logging-juli:8.0.20
|    |    |    \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.0.20
|    |    |         \--- org.apache.tomcat.embed:tomcat-embed-core:8.0.20
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.4.5 (*)
|    |    +--- org.hibernate:hibernate-validator:5.1.3.Final
|    |    |    +--- javax.validation:validation-api:1.1.0.Final
|    |    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA
|    |    |    \--- com.fasterxml:classmate:1.0.0
|    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-web:4.1.5.RELEASE
|    |    |    +--- org.springframework:spring-aop:4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-beans:4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    \--- org.springframework:spring-webmvc:4.1.5.RELEASE
|    |         +--- org.springframework:spring-beans:4.1.5.RELEASE (*)
|    |         +--- org.springframework:spring-context:4.1.5.RELEASE (*)
|    |         +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |         +--- org.springframework:spring-expression:4.1.5.RELEASE (*)
|    |         \--- org.springframework:spring-web:4.1.5.RELEASE (*)
|    +--- org.springframework.boot:spring-boot-starter:1.2.2.RELEASE (*)
|    +--- org.springframework.boot:spring-boot-starter-data-jpa:1.2.2.RELEASE
|    |    +--- org.springframework.boot:spring-boot-starter:1.2.2.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-starter-aop:1.2.2.RELEASE
|    |    |    +--- org.springframework.boot:spring-boot-starter:1.2.2.RELEASE (*)
|    |    |    +--- org.springframework:spring-aop:4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |    +--- org.aspectj:aspectjrt:1.8.5
|    |    |    \--- org.aspectj:aspectjweaver:1.8.5
|    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-starter-jdbc:1.2.2.RELEASE
|    |    |    +--- org.springframework.boot:spring-boot-starter:1.2.2.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-jdbc:4.1.5.RELEASE
|    |    |    |    +--- org.springframework:spring-beans:4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |    |    \--- org.springframework:spring-tx:4.1.5.RELEASE (*)
|    |    |    +--- org.apache.tomcat:tomcat-jdbc:8.0.20
|    |    |    |    \--- org.apache.tomcat:tomcat-juli:8.0.20
|    |    |    \--- org.springframework:spring-tx:4.1.5.RELEASE (*)
|    |    +--- org.hibernate:hibernate-entitymanager:4.3.8.Final
|    |    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA
|    |    |    +--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
|    |    |    +--- org.hibernate:hibernate-core:4.3.8.Final
|    |    |    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA
|    |    |    |    +--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
|    |    |    |    +--- dom4j:dom4j:1.6.1
|    |    |    |    |    \--- xml-apis:xml-apis:1.0.b2
|    |    |    |    +--- org.hibernate.common:hibernate-commons-annotations:4.0.5.Final
|    |    |    |    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA
|    |    |    |    |    \--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
|    |    |    |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final
|    |    |    |    +--- org.javassist:javassist:3.18.1-GA
|    |    |    |    +--- antlr:antlr:2.7.7
|    |    |    |    \--- org.jboss:jandex:1.1.0.Final
|    |    |    +--- dom4j:dom4j:1.6.1 (*)
|    |    |    +--- org.hibernate.common:hibernate-commons-annotations:4.0.5.Final (*)
|    |    |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final
|    |    |    \--- org.javassist:javassist:3.18.1-GA
|    |    +--- javax.transaction:javax.transaction-api:1.2
|    |    +--- org.springframework:spring-orm:4.1.5.RELEASE
|    |    |    +--- org.springframework:spring-beans:4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-jdbc:4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-tx:4.1.5.RELEASE (*)
|    |    +--- org.springframework.data:spring-data-jpa:1.7.2.RELEASE
|    |    |    +--- org.springframework.data:spring-data-commons:1.9.2.RELEASE
|    |    |    |    +--- org.springframework:spring-core:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-beans:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.slf4j:slf4j-api:1.7.10
|    |    |    |    \--- org.slf4j:jcl-over-slf4j:1.7.10 (*)
|    |    |    +--- org.springframework:spring-orm:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-aop:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-tx:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-beans:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.aspectj:aspectjrt:1.8.4 -> 1.8.5
|    |    |    +--- org.slf4j:slf4j-api:1.7.10
|    |    |    \--- org.slf4j:jcl-over-slf4j:1.7.10 (*)
|    |    \--- org.springframework:spring-aspects:4.1.5.RELEASE
|    |         \--- org.aspectj:aspectjweaver:1.8.5
|    +--- org.springframework.boot:spring-boot-starter-log4j:1.2.2.RELEASE
|    |    +--- org.slf4j:jcl-over-slf4j:1.7.10 (*)
|    |    +--- org.slf4j:jul-to-slf4j:1.7.10 (*)
|    |    +--- org.slf4j:slf4j-log4j12:1.7.10
|    |    |    +--- org.slf4j:slf4j-api:1.7.10
|    |    |    \--- log4j:log4j:1.2.17
|    |    \--- log4j:log4j:1.2.17
|    +--- javax.validation:validation-api:1.1.0.Final
|    +--- org.hibernate:hibernate-validator:5.0.1.Final -> 5.1.3.Final (*)
|    +--- com.playtika.core:infra-messaging-framework:0.0.14
|    |    +--- org.springframework:spring-web:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-oxm:3.2.9.RELEASE -> 4.1.2.RELEASE
|    |    |    +--- org.springframework:spring-beans:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-core:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- commons-io:commons-io:2.4
|    |    +--- org.codehaus.jackson:jackson-core-asl:1.9.2
|    |    +--- org.codehaus.jackson:jackson-mapper-asl:1.9.2
|    |    |    \--- org.codehaus.jackson:jackson-core-asl:1.9.2
|    |    +--- org.scala-lang:scala-library:2.10.0 -> 2.10.1
|    |    +--- org.scala-lang:scala-compiler:2.10.0
|    |    |    +--- org.scala-lang:scala-library:2.10.0 -> 2.10.1
|    |    |    \--- org.scala-lang:scala-reflect:2.10.0
|    |    |         \--- org.scala-lang:scala-library:2.10.0 -> 2.10.1
|    |    +--- org.apache.kafka:kafka_2.10:0.8.1
|    |    |    +--- com.yammer.metrics:metrics-annotation:2.2.0
|    |    |    +--- com.yammer.metrics:metrics-core:2.2.0
|    |    |    +--- org.xerial.snappy:snappy-java:1.0.5
|    |    |    +--- org.apache.zookeeper:zookeeper:3.3.4
|    |    |    |    \--- jline:jline:0.9.94
|    |    |    +--- net.sf.jopt-simple:jopt-simple:3.2
|    |    |    +--- org.scala-lang:scala-library:2.10.1
|    |    |    \--- com.101tec:zkclient:0.3
|    |    |         \--- org.apache.zookeeper:zookeeper:3.3.1 -> 3.3.4 (*)
|    |    +--- net.sf.jopt-simple:jopt-simple:3.2
|    |    +--- org.apache.zookeeper:zookeeper:3.3.4 (*)
|    |    +--- com.yammer.metrics:metrics-core:2.2.0
|    |    +--- com.yammer.metrics:metrics-annotation:2.2.0
|    |    +--- com.101tec:zkclient:0.3 (*)
|    |    +--- org.xerial.snappy:snappy-java:1.0.4.1 -> 1.0.5
|    |    \--- com.playtika.services.configuration:ConfigurationManager:2.0.3-SNAPSHOT -> 2.0.8
|    |         +--- com.playtika.services.configuration:ConfigurationCommon:2.0.3
|    |         |    \--- commons-lang:commons-lang:2.4 -> 2.6
|    |         +--- com.caucho:resin-hessian:4.0.23
|    |         +--- org.springframework:spring-jdbc:3.1.0.RELEASE -> 4.1.5.RELEASE (*)
|    |         +--- com.adobe.blazeds:blazeds-common:3.2.0.3978
|    |         +--- com.adobe.blazeds:blazeds-proxy:3.2.0.3978
|    |         +--- org.codehaus.jackson:jackson-core-asl:1.9.2
|    |         +--- org.codehaus.jackson:jackson-mapper-asl:1.9.2 (*)
|    |         \--- org.mockito:mockito-all:1.9.5
|    +--- com.playtika.services.configuration:ConfigurationManager:2.0.8 (*)
|    +--- com.caucho:resin-hessian:4.0.23
|    +--- mysql:mysql-connector-java:5.1.34
|    +--- org.springframework.data:spring-data-couchbase:1.2.2.RELEASE
|    |    +--- org.springframework:spring-context:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-web:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-tx:4.0.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework.data:spring-data-commons:1.9.2.RELEASE (*)
|    |    +--- com.couchbase.client:couchbase-client:1.4.4
|    |    |    +--- io.netty:netty:3.5.5.Final
|    |    |    +--- org.codehaus.jettison:jettison:1.1 -> 1.2
|    |    |    |    \--- stax:stax-api:1.0.1
|    |    |    +--- commons-codec:commons-codec:1.5 -> 1.9
|    |    |    +--- net.spy:spymemcached:2.11.4
|    |    |    +--- org.apache.httpcomponents:httpcore:4.3 -> 4.4
|    |    |    \--- org.apache.httpcomponents:httpcore-nio:4.3
|    |    |         \--- org.apache.httpcomponents:httpcore:4.3 -> 4.4
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.3.2 -> 2.4.5 (*)
|    |    +--- org.slf4j:slf4j-api:1.7.10
|    |    \--- org.slf4j:jcl-over-slf4j:1.7.10 (*)
|    \--- javax.inject:javax.inject:1
+--- project :batch
|    +--- org.springframework.batch:spring-batch-integration:3.0.1.RELEASE -> 3.0.3.RELEASE
|    |    +--- org.springframework.batch:spring-batch-core:3.0.3.RELEASE
|    |    |    +--- com.ibm.jbatch:com.ibm.jbatch-tck-spi:1.0
|    |    |    |    \--- javax.batch:javax.batch-api:1.0
|    |    |    +--- com.thoughtworks.xstream:xstream:1.4.7
|    |    |    |    +--- xmlpull:xmlpull:1.1.3.1
|    |    |    |    \--- xpp3:xpp3_min:1.1.4c
|    |    |    +--- org.codehaus.jettison:jettison:1.2 (*)
|    |    |    +--- org.springframework.batch:spring-batch-infrastructure:3.0.3.RELEASE
|    |    |    |    \--- org.springframework.retry:spring-retry:1.1.0.RELEASE -> 1.1.1.RELEASE
|    |    |    |         \--- org.springframework:spring-context:4.0.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-aop:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-beans:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-tx:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework.integration:spring-integration-core:4.0.1.RELEASE -> 4.1.2.RELEASE
|    |    |    +--- org.springframework:spring-tx:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.projectreactor:reactor-core:1.1.4.RELEASE
|    |    |    |    +--- com.goldmansachs:gs-collections:5.1.0
|    |    |    |    |    \--- com.goldmansachs:gs-collections-api:5.1.0
|    |    |    |    +--- com.lmax:disruptor:3.2.1
|    |    |    |    +--- io.gatling:jsr166e:1.0
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7 -> 1.7.10
|    |    |    +--- org.springframework:spring-aop:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework.retry:spring-retry:1.1.1.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-messaging:4.1.4.RELEASE (*)
|    |    +--- org.springframework.retry:spring-retry:1.1.0.RELEASE -> 1.1.1.RELEASE (*)
|    |    +--- org.springframework:spring-aop:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-messaging:4.0.5.RELEASE -> 4.1.4.RELEASE (*)
|    |    \--- org.springframework:spring-tx:4.0.5.RELEASE -> 4.1.5.RELEASE (*)
|    +--- org.springframework.batch:spring-batch-admin-manager:2.0.0.M1
|    |    +--- org.aspectj:aspectjrt:1.8.2 -> 1.8.5
|    |    +--- org.aspectj:aspectjweaver:1.8.2 -> 1.8.5
|    |    +--- org.springframework:spring-context-support:4.1.2.RELEASE
|    |    |    +--- org.springframework:spring-beans:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-core:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework.batch:spring-batch-core:3.0.3.RELEASE (*)
|    |    +--- org.springframework:spring-jdbc:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-aop:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework.batch:spring-batch-integration:3.0.3.RELEASE (*)
|    |    +--- org.springframework.integration:spring-integration-core:4.1.2.RELEASE (*)
|    |    +--- org.springframework.integration:spring-integration-jmx:4.1.2.RELEASE
|    |    |    \--- org.springframework.integration:spring-integration-core:4.1.2.RELEASE (*)
|    |    +--- org.springframework.integration:spring-integration-http:4.1.2.RELEASE
|    |    |    +--- org.springframework:spring-webmvc:4.1.4.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework.integration:spring-integration-core:4.1.2.RELEASE (*)
|    |    +--- org.springframework.integration:spring-integration-file:4.1.2.RELEASE
|    |    |    +--- commons-io:commons-io:2.4
|    |    |    \--- org.springframework.integration:spring-integration-core:4.1.2.RELEASE (*)
|    |    +--- commons-dbcp:commons-dbcp:1.4
|    |    |    \--- commons-pool:commons-pool:1.5.4
|    |    +--- commons-io:commons-io:2.4
|    |    +--- commons-lang:commons-lang:2.6
|    |    +--- commons-fileupload:commons-fileupload:1.3.1
|    |    |    \--- commons-io:commons-io:2.2 -> 2.4
|    |    +--- org.slf4j:jcl-over-slf4j:1.7.7 -> 1.7.10 (*)
|    |    +--- commons-collections:commons-collections:3.2.1
|    |    +--- org.freemarker:freemarker:2.3.20
|    |    +--- org.springframework.batch:spring-batch-admin-resources:2.0.0.M1
|    |    |    +--- org.springframework:spring-aop:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.slf4j:jcl-over-slf4j:1.7.7 -> 1.7.10 (*)
|    |    |    +--- commons-io:commons-io:2.4
|    |    |    +--- commons-collections:commons-collections:3.2.1
|    |    |    +--- org.springframework:spring-context-support:4.1.2.RELEASE (*)
|    |    |    +--- org.springframework.data:spring-data-commons:1.9.1.RELEASE -> 1.9.2.RELEASE (*)
|    |    |    +--- org.springframework.hateoas:spring-hateoas:0.16.0.RELEASE
|    |    |    |    +--- org.springframework:spring-aop:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-beans:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-context:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-core:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-web:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-webmvc:3.2.9.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    \--- org.objenesis:objenesis:2.1
|    |    |    +--- com.fasterxml.jackson.core:jackson-databind:2.4.2 -> 2.4.5 (*)
|    |    |    +--- org.springframework.batch:spring-batch-admin-domain:2.0.0.M1
|    |    |    |    +--- org.springframework:spring-context-support:4.1.2.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-context:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- org.springframework.batch:spring-batch-core:3.0.3.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-aop:4.1.2.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    |    +--- commons-logging:commons-logging:1.2
|    |    |    |    +--- com.fasterxml.jackson.core:jackson-databind:2.4.2 -> 2.4.5 (*)
|    |    |    |    +--- org.springframework.data:spring-data-commons:1.9.1.RELEASE -> 1.9.2.RELEASE (*)
|    |    |    |    +--- org.springframework.hateoas:spring-hateoas:0.16.0.RELEASE (*)
|    |    |    |    +--- org.springframework:spring-oxm:4.1.2.RELEASE (*)
|    |    |    |    \--- joda-time:joda-time:2.5 -> 2.7
|    |    |    \--- commons-dbcp:commons-dbcp:1.4 (*)
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.4.2 -> 2.4.5 (*)
|    |    +--- org.springframework.data:spring-data-commons:1.9.1.RELEASE -> 1.9.2.RELEASE (*)
|    |    +--- org.springframework.hateoas:spring-hateoas:0.16.0.RELEASE (*)
|    |    +--- org.springframework.plugin:spring-plugin-core:1.1.0.RELEASE
|    |    |    +--- org.springframework:spring-beans:3.2.8.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:3.2.8.RELEASE -> 4.1.5.RELEASE (*)
|    |    |    \--- org.springframework:spring-aop:3.2.8.RELEASE -> 4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-oxm:4.1.2.RELEASE (*)
|    |    \--- com.jayway.jsonpath:json-path:1.2.0
|    |         \--- net.minidev:json-smart:2.1.0
|    |              \--- net.minidev:asm:1.0.2
|    |                   \--- asm:asm:3.3.1
|    +--- commons-dbcp:commons-dbcp:1.4 (*)
|    +--- org.springframework.boot:spring-boot-starter-batch:1.2.2.RELEASE
|    |    +--- org.hsqldb:hsqldb:2.3.2
|    |    +--- org.springframework:spring-core:4.1.5.RELEASE (*)
|    |    +--- org.springframework:spring-jdbc:4.1.5.RELEASE (*)
|    |    \--- org.springframework.batch:spring-batch-core:3.0.3.RELEASE (*)
|    \--- project :common (*)
\--- project :scheduler
     +--- commons-dbcp:commons-dbcp:1.4 (*)
     \--- project :common (*)

我还是

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/dev/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.10/b3eeae7d1765f988a1f45ea81517191315c69c9e/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/dev/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.1.2/b316e9737eea25e9ddd6d88eaeee76878045c6b2/logback-classic-1.1.2.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 [org.slf4j.impl.Log4jLoggerFactory]
Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/C:/dev/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.10/b3eeae7d1765f988a1f45ea81517191315c69c9e/slf4j-log4j12-1.7.10.jar). If you are using Weblogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.impl.Log4jLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext
    at org.springframework.util.Assert.isInstanceOf(Assert.java:339)

有什么想法吗?谢谢。

添加了主要模块的build.gradle依赖项部分:

批处理模块:

dependencies {
    compile('org.springframework.batch:spring-batch-integration:3.0.1.RELEASE')
            {
                exclude module:'com.fasterxml.jackson.core'
            }
    compile("org.springframework.batch:spring-batch-admin-manager:2.0.0.M1"){
        exclude module: 'slf4j-log4j12'
        exclude module: 'slf4j-api'
    }

    compile('commons-dbcp:commons-dbcp:1.4')
    compile("org.springframework.boot:spring-boot-starter-batch:$project.ext.springBatchVersion")
            {
                exclude group: 'ch.qos.logback'
                exclude module: 'spring-boot-starter'
            }
    testCompile("org.springframework.batch:spring-batch-test:3.0.3.RELEASE") {
        exclude(module: 'spring-test')
        exclude(module: 'spring-jdbc')
        exclude(module: 'commons-io')
        exclude(module: 'commons-collections')
    }
    compile project(":common")
    testCompile('mysql:mysql-connector-java:5.1.34')

}

常用模块:

依赖项{

    compile("obsidian:obsidian:3.0")
    compile("joda-time:joda-time:2.7")
    compile("org.apache.httpcomponents:httpmime:4.4")
    compile("org.apache.httpcomponents:httpclient:4.4")
    compile("com.google.code.gson:gson:2.3.1")
    compile('net.sf.opencsv:opencsv:2.3')

   compile('me.moocar:logback-gelf:0.12')
            {
                exclude(module: 'logback-classic')
            }
    compile("org.springframework:spring-jms:4.1.4.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-web:$project.ext.springBootVersion")
            {
                exclude group:'ch.qos.logback'
                exclude module: 'org.springframework.boot:spring-boot-starter-logging'
            }
    compile("org.springframework.boot:spring-boot-starter:$project.ext.springBootVersion")
            {
                exclude module: 'spring-boot-starter-logging'
            }

    compile("org.springframework.boot:spring-boot-starter-log4j:1.2.2.RELEASE")

    testCompile("org.springframework.boot:spring-boot-starter-test:$project.ext.springBootVersion")
  compile("org.springframework.boot:spring-boot-starter-data-jpa:$project.ext.springBootVersion")
            {
                exclude group: 'ch.qos.logback'
            }

添加web项目的依赖项(可执行项目)

dependencies {
    compile("org.springframework.boot:spring-boot-starter-actuator:$project.ext.springBootVersion")
            {
                exclude module: 'org.springframework.boot:spring-boot-starter:1.2.2.RELEASE'
            }
    compile project(":common")
    compile project(":batch")
    compile project(":scheduler")
}

2 个答案:

答案 0 :(得分:5)

您仍然将Logback作为传递依赖项。

当Gradle在依赖项上声明时,Gradle对于排除项有点挑剔 - 它要求依赖项的每个“路由”排除或排除都不会生效。

请尝试使用配置范围的排除。例如:

configurations {
    compile.exclude group:'ch.qos.logback'
}

答案 1 :(得分:2)

你排除了常见的伐木吗?根据你的依赖关系,你没有。

dependencies {
   compile ('org.springframework.boot:spring-boot-starter-web'){
    exclude module: 'org.springframework.boot:spring-boot-starter-logging'
}
compile ('org.springframework.boot:spring-boot-starter-log4j')
}