Gradle 依赖未加载 gradle tomcat 插件
Gradle dependency Is not loaded with gradle tomcat plugin
我有
compile 'org.slf4j:slf4j-jdk14:1.0'
在我的依赖项中,仍然得到
Caused by: java.lang.NoClassDefFoundError: org/slf4j/spi/LoggerFactoryBinder
当 运行
gradle clean tomcatRun
这个 tomcat class 加载程序有什么问题?
您的 tomcatRun 任务是否从编译中获得了类路径?
configurations{
tomcatRun
}
dependecies{
compile 'org.slf4j:slf4j-jdk14:1.0'
tomcatRun configurations.compile
}
tomcatRun{
classpath = configurations.tomcatRun
}
我不知道它是否适合你使用 tomcat运行,但是对于 tomcastJasper,我在你设置 [=13] 的 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"
}
我有
compile 'org.slf4j:slf4j-jdk14:1.0'
在我的依赖项中,仍然得到
Caused by: java.lang.NoClassDefFoundError: org/slf4j/spi/LoggerFactoryBinder
当 运行
gradle clean tomcatRun
这个 tomcat class 加载程序有什么问题?
您的 tomcatRun 任务是否从编译中获得了类路径?
configurations{
tomcatRun
}
dependecies{
compile 'org.slf4j:slf4j-jdk14:1.0'
tomcatRun configurations.compile
}
tomcatRun{
classpath = configurations.tomcatRun
}
我不知道它是否适合你使用 tomcat运行,但是对于 tomcastJasper,我在你设置 [=13] 的 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"
}