我有
compile 'org.slf4j:slf4j-jdk14:1.0'
在我的依赖项中,仍然是
Caused by: java.lang.NoClassDefFoundError: org/slf4j/spi/LoggerFactoryBinder
运行时
gradle clean tomcatRun
这个tomcat类加载器出了什么问题?
答案 0 :(得分:0)
你的tomcatRun任务是否有编译的类路径?
configurations{
tomcatRun
}
dependecies{
compile 'org.slf4j:slf4j-jdk14:1.0'
tomcatRun configurations.compile
}
tomcatRun{
classpath = configurations.tomcatRun
}
答案 1 :(得分:0)
我不知道它是否适用于tomcatRun,但对于tomcastJasper,我在tomcat配置中添加了依赖项,您可以在其中设置tomcat版本信息:
dependencies {
def tomcatVersion = '8.0.42'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}",
"javax.servlet:jstl:1.2"
}