java - gradle 从运行时依赖项中排除特定的 jar
问题描述
有没有办法使用 Gradle 从组中排除特定的罐子?我试过下面的代码,但这删除了该组的所有罐子
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
推荐阅读
- c# - 将表达式树与 Where Any EntityCore 一起使用
- graphviz - ER图:由于等级相等而避免超宽图
- r - install.packages() 执行没有错误,但 library() 无法找到/获取调用的包。为什么?
- css - Bootstrap.min.css 更改我的顶部导航栏、间距和字体
- python - Function Approximation With Scikit-Learn MLP Regressor
- boost-python - Boost Python: Callback from c++ to python produces segmentation fault
- python - How to run a test marked skip in pytest
- php - 自动插入新评论时如何在帖子表上的评论表引用上添加帖子的字段块
- jasper-reports - JasperReports 中的元素可以配置为向下浮动而不是向上浮动吗?
- python - 如何在执行其余功能之前让不和谐机器人检查用户角色?