How to see dependency tree in sbt?

Cherry picture Cherry · Aug 27, 2014 · Viewed 73.7k times · Source

I am trying to inspect the SBT dependency tree as described in the documentation:

sbt inspect tree clean

But I get this error:

[error] inspect usage:
[error]   inspect [uses|tree|definitions] <key>   Prints the value for 'key', the defining scope, delegates, related definitions, and dependencies.
[error]
[error] inspect
[error]        ^

What is wrong? Why doesn't SBT build the tree?

Answer

OrangeDog picture OrangeDog · May 24, 2016

If you want to actually view the library dependencies (as you would with Maven) rather than the task dependencies (which is what inspect tree displays), then you'll want to use the sbt-dependency-graph plugin.

Add the following to your project/plugins.sbt (or the global plugins.sbt).

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

Then you have access to the dependencyTree command, and others.