Gradle 从运行时依赖项中排除特定的 jar



有没有办法使用 Gradle 从组中排除特定的 jar? 我已经尝试了下面的代码,但这删除了该组的所有罐子

configurations {
all*.exclude group: 'org.xxxx.xxxx'
}

我的要求是仅从组中删除特定的罐子,而不是所有罐子。我们正在做的这个练习是为了在系统运行时排除传递依赖项。

谢谢。

您可以在依赖项块中排除组中的所有依赖项,或仅排除组的某些模块:

dependencies {
/* --------------  SpringBoot without Tomcat  ------------------- */
compile('org.springframework.boot:spring-boot-starter-web') {    
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
}

我添加了指向 Gradle 文档的链接,详细解释了传递依赖项:https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html

最新更新