我们正在使用 gradle 运行一个 spring-boot 应用。
为了包含 spring-boot 插件,我们将其添加为依赖项:
buildscript {
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE")
}
}
不幸的是,这个插件依赖于
org.apache.logging.log4j:log4j-slf4j-impl:2.4.1
我想排除的。
已经尝试通过添加:
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE") {
exclude group: 'org.apache.logging.log4j'
}
}
这是行不通的。
同时添加:
configurations {
classpath.exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
}
没有任何影响。
欢迎任何提示。
最佳答案
如果你想排除
org.apache.logging.log4j:log4j-slf4j-impl:2.4.1
尝试
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE") {
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
}
}
关于java - 删除 gradle 中的传递类路径依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35038027/