Akhil
Akhil

Reputation: 558

How to find unused sbt dependencies?

My build.sbt has a lot of dependencies now. How do I know which dependencies are actually being used?

Maven seems to have dependency:analyse http://maven.apache.org/plugins/maven-dependency-plugin/ Is there something similar for sbt?

Upvotes: 31

Views: 6764

Answers (2)

Diego Alonso
Diego Alonso

Reputation: 761

There is the sbt-explicit-dependencies plugin, which has been developed recently. It has direct commands in the SBT console to:

  • Enforce explicit direct declaration of dependencies, thus disallowing transitive dependencies.
  • Detect and remove unneeded dependencies.

Upvotes: 11

wedens
wedens

Reputation: 1830

you can use sbt-dependency-graph plugin. it shows dependencies in different graphical representations. also you can try to use tattletale, but it's not integrated with sbt. it'll require you to copy managed dependencies (retrieveManaged := true). this tool not only shows dependency graph, but analyzes class usage and can display unused dependencies (including transitive)

Upvotes: 3

Related Questions