Abstract: This article introduce a plugin to help check the relationship of the dependencies in Sbt.
We usually use the Maven Helper in IntelliJ to resolve the conflict of the dependencies of Maven. So how about the sbt?
There is an Sbt plugin can be used for that target: sbt-dependency-graph.
The basic usage is as follow:
sbt backend/dependencyTree: show ASCII graph in a terminal. The output will look like as follows: if the dependency is not active, it will be noted as
(evicted by: 1.3.4). For example, you dependent A[v1] and B[v2], and A[v1] dependent on the B[v1], then the B[v1] will be evicted by the B[v2].
[info] +-com.typesafe.akka:akka-http-xml_2.13:10.1.8 [S]
sbt backend/dependencyBrowseGraph: show graph in a browser. you can check the dependency eviction relation. According to the graph, we can find the rectangle with dash line is the dependency which is evicted by others. By the way, the generated files will be in the target folder:
I think this plugin is essential for the complex sbt project.