PerKins Zhu

Le vent se lève,il faut tenter de vivre.
随笔 - 86, 文章 - 0, 评论 - 45, 阅读 - 21万

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

jar包冲突排解方法(sbt)

Posted on   PerKins.Zhu  阅读(1780)  评论(0编辑  收藏  举报

jar包依赖冲突,版本不兼容会导致各种各样的问题。这里推荐一款sbt插件用于查找项目中的jar包依赖关系,通过该插件可以轻松的看出某个jar包依赖哪些jar,以及某个jar被哪些jar所依赖。此外该插件还可生成可视化图形用于查看依赖关系。

插件地址:https://github.com/jrudolph/sbt-dependency-graph

引用方式:

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")

使用命令:

复制代码
Main Tasks
dependencyTree: Shows an ASCII tree representation of the project's dependencies
dependencyBrowseGraph: Opens a browser window with a visualization of the dependency graph (courtesy of graphlib-dot + dagre-d3).
dependencyBrowseTree: Opens a browser window with a visualization of the dependency tree (courtesy of jstree).
dependencyList: Shows a flat list of all transitive dependencies on the sbt console (sorted by organization and name)
whatDependsOn <organization> <module> <revision>?: Find out what depends on an artifact. Shows a reverse dependency tree for the selected module. The <revision> argument is optional.
dependencyLicenseInfo: show dependencies grouped by declared license
dependencyStats: Shows a table with each module a row with (transitive) Jar sizes and number of dependencies
dependencyGraphMl: Generates a .graphml file with the project's dependencies to target/dependencies-<config>.graphml. Use e.g. yEd to format the graph to your needs.
dependencyDot: Generates a .dot file with the project's dependencies to target/dependencies-<config>.dot. Use graphviz to render it to your preferred graphic format.
dependencyGraph: Shows an ASCII graph of the project's dependencies on the sbt console (only supported on sbt 0.13)
ivyReport: Lets ivy generate the resolution report for you project. Use show ivyReport for the filename of the generated report
复制代码

样例:

 dependencyTree:按照树的方式列出所有的jar依赖关系

 dependencyBrowseTree:绘制依赖关系图,以*.html文件保存,可在浏览器中打开查看

 虚线是被替代的依赖

 

whatDependsOn: 查看指定jar被哪些jar所依赖。使用方式:whatDependsOn <org> <module> <version>
   例如:whatDependsOn com.google.code.gson gson 2.8.0

 

===============================================

原文链接:jar包冲突排解方法(sbt) 转载请注明出处!

===============================================

---end

编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示