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

gradle exclude specific jars from runtime dependencies

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

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

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

谢谢。

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

    dependencies {

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

    }

我将 link 添加到 Gradle 文档中,详细解释了传递依赖关系:https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html