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
标签:
开发工具
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 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框架的用法!