jar包依賴衝突,版本不兼容會致使各類各樣的問題。這裏推薦一款sbt插件用於查找項目中的jar包依賴關係,經過該插件能夠輕鬆的看出某個jar包依賴哪些jar,以及某個jar被哪些jar所依賴。此外該插件還可生成可視化圖形用於查看依賴關係。html
插件地址:https://github.com/jrudolph/sbt-dependency-graphgit
引用方式:github
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
樣例:post
dependencyTree:按照樹的方式列出全部的jar依賴關係google
dependencyBrowseTree:繪製依賴關係圖,以*.html文件保存,可在瀏覽器中打開查看spa
虛線是被替代的依賴插件
whatDependsOn: 查看指定jar被哪些jar所依賴。使用方式:whatDependsOn <org> <module> <version>
例如:whatDependsOn com.google.code.gson gson 2.8.0
===============================================code
原文連接:jar包衝突排解方法(sbt) 轉載請註明出處!orm
===============================================
---end