SRobertJames
SRobertJames

Reputation: 9279

SBT: List project dependency libs

How can I tell SBT to list all libs its bringing into the project? I see that IntelliJ is able to do so.

In my case, SBT is bringing in hadoop-1 (it was a transitive dependency, I believe). I'm trying to make it use hadoop-2 - I added a reference to it in the build.sbt, but I still get the error from using v1, and IntelliJ still shows me "SBT: Hadoop 1" lib

Upvotes: 3

Views: 4083

Answers (2)

marios
marios

Reputation: 8996

Using sbt 0.13.11.

Here is a useful task to have in your project. This will list all jar dependencies.

lazy val showJars = taskKey[Unit]("Print all Jar dependencies")

showJars <<= (target, fullClasspath in Compile) map { (target, cp) =>
   cp.foreach(x => println(x.data))
}

If you want to see a quick list of all the packages you depend on use the libraryDependencies setting:

libraryDependencies

If you want to see the complete graph of what depends on what then use the sat-dependency-graph plugin.

If you are interested on just one module use:

whatDependsOn <organization> <module> <revision>

Upvotes: 1

regexp
regexp

Reputation: 766

For such issues i usually use the sbt-dependency-graph plugin https://github.com/jrudolph/sbt-dependency-graph

To reverse lookup where a dependency comes from just do:

what-depends-on <organization> <module> <revision>

It will produce a nice output of the path to the queried dependency

Upvotes: 7

Related Questions