获取我Java应用程序所需的传递性依赖项列表如何?

huangapple go评论45阅读模式
英文:

how to get list of transitive dependencies required for my java application?

问题

我们有一个要求,需要从源代码构建所有依赖项,这些依赖项将作为应用程序部署的一部分进行部署。所以这里是我的问题,如何获取我的应用程序类路径中所需的传递依赖项的列表(第4/5到第n方的依赖项)。

示例:
我有第三方依赖项spring-core-5.2.6版本,当我从源代码构建这个jar并存储在本地gradle缓存文件夹中时,它下载了220+个依赖项,但当我构建我的应用程序并部署到服务器上时,我只能在应用程序类路径中看到150+个依赖项(这150+包括其他20个第三方依赖项和它们的传递依赖项)。
现在的问题是,在这150个jar中,有哪些来自spring-core-5.2.6的传递依赖项的列表?
在Java中是否有任何插件或任何解决方案可用?

英文:

We have a requirement to build all dependencies from source code which we are deploying as part of application deployment, so here is my question how to get list of transitive dependencies ( 4th/5th to nth party dependancies) which are required in my application class path.

Example :
I have third party dependancy spring-core-5.2.6 version, when I build this jar from source in my local gradle cache folder it’s downloaded 220+ dependencies, but when I build my application and deployed in to server then I can see in application class path 150+ dependencies only ( this 150+ is including other 20 third party dependancies and it’s transitive dependencies).
Now the question is in that 150 jars what are the list of transitive dependencies which are coming from spring-core-5.2.6 ?
Is there any plugins or any solutions are available in java?

答案1

得分: 1

mvn dependency:tree 是一个命令,它将提供所有依赖项以及它们的传递依赖项。

英文:

mvn dependency:tree is the command that will give you all of your dependencies and of their transitive dependencies

答案2

得分: 0

范围还会影响传递依赖关系。具有编译范围的依赖项将在您的主项目中引入其编译和运行时范围的依赖项,但不会引入测试/提供的范围的依赖项,请参阅此文档

英文:

The scope can also affect transitive dependencies.A dependency with the scope compile, will bring its dependencies with scope compile and runtime in your main project, but will not bring those with scope test/provided, see this doc

huangapple
  • 本文由 发表于 2020年8月2日 01:42:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/63208249.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定