小编que*_*ire的帖子

在gradle中删除传递类路径依赖项

我们正在用gradle运行一个spring-boot应用程序.

为了包含spring-boot插件,我们将其添加为依赖项:

buildscript {
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE") 
    }
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,这个插件附带了依赖 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'
        }
    }
Run Code Online (Sandbox Code Playgroud)

哪个不起作用.

还添加:

configurations {
    classpath.exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
}
Run Code Online (Sandbox Code Playgroud)

没有任何影响.

任何提示都是受欢迎的.

java dependency-management gradle spring-boot

9
推荐指数
4
解决办法
5929
查看次数

标签 统计

dependency-management ×1

gradle ×1

java ×1

spring-boot ×1