java - SLF4J: Class path contains multiple SLF4J bindings. multiple logback-classic jars -
i bulding , run spring web app using gradle. there multiple bindings. reading existing posts, found lots of similar problems. have 2 problems. (1) can not find conflict depencies. (2) not fimilar gradle syntaxt. tried lots of methods. still confused. welcome. thanks. here error:
slf4j: class path contains multiple slf4j bindings.
slf4j: found bindings in [jar:file:/c:/myproject/gradle-2.3-all/gradle-2.3/lib/logback-classic-1.0.13.jar!/org/slf4j/impl/statloggerbinder.class]
slf4j: found bindings in [jar:file:/c:/myproject/myproject/build/temp/tomcatrunwar/work/tomcat/localhost/myproject/web-inf/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/statloggerbinder.class]
slf4j: actual binding of type [ch.qos.logback.classic.util.contextselectorstaticbinder]
below depencies:
buildscript { repositories { maven { url "http://repo.spring.io/libs-release" } mavenlocal() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.1.release") classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4' }} apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'spring-boot' apply plugin: 'war' apply plugin: 'groovy' apply plugin: 'tomcat' eclipse { jdt { sourcecompatibility = 1.8 targetcompatibility = 1.8 }} jar { basename = 'myproject' version = '0.1.0' } repositories { mavencentral() maven { url "http://repo.spring.io/libs-release" } } dependencies { compile('commons-fileupload:commons-fileupload:1.3.1') compile("org.codehaus.jackson:jackson-mapper-asl:1.9.0") compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.data:spring-data-mongodb") compile("org.springframework.security:spring-security-crypto:3.2.3.release") compile("com.fasterxml.jackson.core:jackson-databind") compile("joda-time:joda-time:2.2") compile("org.apache.directory.studio:org.apache.commons.codec:1.6") compile('com.amazonaws:aws-java-sdk:1.2.1') testcompile("junit:junit") runtime 'javax.servlet:jstl:1.2' providedcompile group:"org.apache.tomcat", name:"tomcat-catalina", version:"7.0.47" } dependencies { def tomcatversion = '7.0.47' tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatversion}", "org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatversion}" tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatversion}") { exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj' } } tomcatrun { daemon = true httpport = 8080 outputfile = file('/logs/tomcat.log') stopkey = 'ctl-d' webdefaultxml = file('src/main/webapp/web-inf/web.xml') } tomcatrunwar { outputfile = file('/logs/tomcat.log') } tomcatstop { stopkey = 'ctl-d' }
start doing on command line:
gradle dependencies > foo.txt
and go coffee while completes. resulting file contain full dependency tree. search logback.
then when you're modifying build file, far can tell (i'm relatively new @ gradle too), need exclude either module or group, not both. group part before colon, module part after.
looking again @ details of error, think problem contained in here:
"org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatversion}"
so think should break out own line/dependency , put exclude there.
Comments
Post a Comment