Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out where sbt resolves dependencies from?

Tags:

scala

sbt

I am using sbt 0.12 RC2.

My project has a bunch of library dependencies, and some of these trigger other dependencies. Some of these dependencies are unmanaged (in lib/), some are in my local .ivy2 repository, some are found in various remote repositories.

I'm looking for an sbt update-verbose or similar that will tell me exactly where sbt found each JAR file when it says:

[info] Resolving com.nicta#sbt-scoobi;0.0.1 ...
[info] Resolving org.scala-lang#scala-library;2.9.2 ...
[info] Resolving org.apache.opennlp#opennlp-maxent;3.0.1-incubating ...
[info] Resolving jwnl#jwnl;1.3.3 ...
like image 501
Urban Vagabond Avatar asked Aug 05 '12 00:08

Urban Vagabond


People also ask

Where are SBT dependencies stored?

All new SBT versions (after 0.7. x ) by default put the downloaded JARS into the . ivy2 directory in your home directory. If you are using Linux, this is usually /home/<username>/.

How do we specify library dependencies in SBT?

The libraryDependencies key Most of the time, you can simply list your dependencies in the setting libraryDependencies . It's also possible to write a Maven POM file or Ivy configuration file to externally configure your dependencies, and have sbt use those external configuration files.

Which is the correct way to add dependencies in SBT file?

If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.


3 Answers

sbtgenerates a very extensive report on how exactly the dependencies were resolved in target/resolution-cache/reports. Open one of the .xml files in a web browser, and you should see all the detail you need.

like image 141
lutzh Avatar answered Oct 26 '22 22:10

lutzh


I'm not sure if this applies to sbt 0.12.x, but in 0.13.x, if you can find where your library lives in in the ~/.ivy/cache/... directory structure, the library's parent directory has a file named ivydata-x.y.z.properties which contains the URL where it found the dependency.

For example, if you cache for akka-streams looks like this:

.ivy2
└── cache
    └── com.typesafe.akka
        └── akka-stream_2.11
            ├── docs
            │   └── akka-stream_2.11-2.4.14-javadoc.jar
            ├── jars
            │   └── akka-stream_2.11-2.4.14.jar
            └── srcs
                └── akka-stream_2.11-2.4.14-sources.jar

you should find a file like this, containing download URL:

.ivy2
└── cache
    └── com.typesafe.akka
        └── akka-stream_2.11
            └──ivydata-2.4.14.properties
like image 43
metasim Avatar answered Oct 26 '22 22:10

metasim


You can use show compile:dependency-classpath to show where the depedencies are

like image 39
Guillaume Massé Avatar answered Oct 26 '22 22:10

Guillaume Massé