[英]Get all 3rd Party dependencies module is using in Maven
We have a multi-module maven project.我们有一个多模块 maven 项目。 I have a use case where I want to know to get a list of all the dependencies which is being used in code with version:我有一个用例,我想知道获取代码中使用的所有依赖项的列表,其中包含版本:
Bonus would be if the approach can exclude the deps which are being declared in pom but not being used in the code.如果该方法可以排除在 pom 中声明但未在代码中使用的 deps,则奖励将是。
Please suggest the best way to achieve this.请提出实现这一目标的最佳方法。 TIA. TIA。
Just use the mvn dependency:tree
command.只需使用mvn dependency:tree
命令。
There's the Maven Dependency Plugin :有Maven 依赖插件:
The dependency plugin provides the capability to manipulate artifacts.依赖插件提供了操作工件的能力。 It can copy and/or unpack artifacts from local or remote repositories to a specified location.它可以将工件从本地或远程存储库复制和/或解压缩到指定位置。
Displays the dependency tree for this project.显示此项目的依赖关系树。
Regarding your bonus there's the analyze
goal:关于你的奖金有analyze
目标:
analyzes the dependencies of this project and determines which are: used and declared;分析该项目的依赖关系并确定哪些是:已使用和已声明; used and undeclared;使用和未声明; unused and declared.未使用和声明。
and the analyze-only goal:以及仅分析的目标:
is the same as analyze, but is meant to be bound in a pom.与analyze 相同,但被绑定在pom 中。 It does not fork the build and execute test-compile.它不会分叉构建并执行测试编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.