确定传递依赖的来源 [英] Determine source of transitive dependency

查看:71
本文介绍了确定传递依赖的来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,其中将sl4j与log4j一起使用.我最近在项目中添加了一些新的依赖项,添加的这些新依赖项之一包括对logback-classic的传递性依赖项,其中包括对sj4j的另一种绑定.

I have a project in which I am using sl4j with log4j. I recently added a few new dependencies to my project, and one of these new dependencies that I added is including a transitive dependency to logback-classic, which includes another binding for sj4j.

我想摆脱logback,但是我不知道哪个直接依赖项添加了传递性依赖项,以便可以排除它.

I want to get rid of logback, but I have no clue which of my direct dependencies added the transitive dependency so that I can exclude it.

在maven中,我知道如何获取整个依赖关系图以确定哪个是传递依赖的来源,但是我不知道如何使用gradle进行此操作.

In maven I know how to get the entire graph of dependencies to determine which is the source of a transitive dependency, but I have no clue of how to do this with gradle.

有人知道如何使用gradle获取传递依赖项的源依赖项吗?

Does anyone knows how to get the source dependency of a transitive dependency with gradle?

推荐答案

要显示每个类路径的整个依赖关系树,请使用 gradle依赖关系.如果只对特定的类路径感兴趣,请使用(例如) gradle依赖性--configuration compile .使用 -p 选项在子项目上运行.

To show the whole dependency tree for each class path, use gradle dependencies. If you are only interested in a particular class path, use (say) gradle dependencies --configuration compile. Use the -p option to run on a sub-project.

要显示谁将特定依赖项拉到特定类路径上以及如何解决任何版本冲突,请使用(例如) gradleDependencyInsight --dependency logback --configuration compile .

To show who pulls in a particular dependency onto a particular class path, and how any version conflicts were resolved, use (say) gradle dependencyInsight --dependency logback --configuration compile.

请注意,您还可以从整个类路径(或多个)中排除依赖项.通常,这比排除特定的传递依赖关系更可靠.例如:

Note that you can also exclude a dependency from a whole class path (or multiple). Usually this is more reliable than excluding a particular transitive dependency. For example:

configurations.all*.exclude module: "logback-classic"

这篇关于确定传递依赖的来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆