愚蠢的问题,但我在这里有点迷路。
我从配置编译中排除 slf4j-api。
configurations {
compile.exclude module: "spring-boot-starter-tomcat"
compile.exclude module: "tomcat-embed-el"
compile.exclude module: "logback-classic"
compile.exclude module: "spring-boot-starter-logging"
compile.exclude module: "slf4j-api"
}
不,由于缺少 slf4j 依赖项,我无法再编译这些类,该依赖项稍后将由容器提供。我试图添加
compileOnly group:....
providedCompile group ....
provided (plugin by netflix)
但到目前为止它不起作用。总是收到错误
can not find symbol org.slf4j....
import failed .....
那么如何在可识别的 gradle 中添加 compileOnly 依赖项?
问候
马蒂亚斯
最佳答案
你试过只编译 而不是 compile.exclude 模块 , 就像 servlet api 一样
compileOnly 'javax.servlet:servlet-api:2.5'
关于java - 由于缺少排除的依赖项,Gradle compileJava 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48537530/