Dependency management

18 views
Skip to first unread message

Maatary Okouya

unread,
Aug 4, 2014, 4:19:27 PM8/4/14
to simple-b...@googlegroups.com
Hi, 

I would like to clarify something about dependency management and SBT. 


1- Let say I have a project A that depends on a Project B, does every library on which Project B depends on, automatically added to the Project A when it comes to runtime execution? 
Usually in eclipse to deal with that problem one had to export the dependency of Project B, so they could be visible to any importing project. 

I would like to understand how does that work when working with SBt. I believe this is called multi-module project dependency in sbt vocabulary.

2- I would like to understand how does that work, for a library artifact generated as well. Is there an equivalent of the of Maven Pom ? That is if i depend on a library how sbt (or Ivy) knows the other libraries that library depend on. 


Finally, if someone can point me to some good doc about this i would appreciate. 

Many thanks



Josh Suereth

unread,
Aug 5, 2014, 2:00:42 PM8/5/14
to simple-b...@googlegroups.com
On Mon, Aug 4, 2014 at 4:19 PM, Maatary Okouya <maatar...@gmail.com> wrote:
Hi, 

I would like to clarify something about dependency management and SBT. 


1- Let say I have a project A that depends on a Project B, does every library on which Project B depends on, automatically added to the Project A when it comes to runtime execution? 
Usually in eclipse to deal with that problem one had to export the dependency of Project B, so they could be visible to any importing project. 


IT's done by configurations.  I recommend learning more about ivy, but in general:

A depends on B  (lazy val a = project.dependsOn(b)), implies:   All artifacts in the compile configuration of B are included in the compile configuration of B.

You can adjust configurations:

(lazy val a = project.dependsOn(b % "test->test;compile->compile"))  implies:  All artifacts in compile configuration of B are included in the compile configuration of A, as well as all artifacts in the test configuration of B are included in the test configuration of A.

IF you've seen libraryDependencies += .... % "test",  this is short for "test->compile", i.e. my test configuration depends on the remote project's compile configuration artifacts.
 
I would like to understand how does that work when working with SBt. I believe this is called multi-module project dependency in sbt vocabulary.


Please read up on Apache Ivy, as that's what we use under the covers, with some slight modifications.
 
2- I would like to understand how does that work, for a library artifact generated as well. Is there an equivalent of the of Maven Pom ? That is if i depend on a library how sbt (or Ivy) knows the other libraries that library depend on. 


Sbt has an internal representation for the "pom", but essentially if you do "show update" you can see the full details of your specified configurations and what was resolved.  Please read:


Intro material: http://www.scala-sbt.org/0.13/tutorial/Library-Dependencies.html
Advanced details: http://www.scala-sbt.org/0.13/tutorial/Library-Dependencies.html

Maatary Okouya

unread,
Aug 6, 2014, 5:36:16 AM8/6/14
to simple-b...@googlegroups.com
Many thanks. Got it. I went in Ivy indeed and that helps a lot. A bit of back and forth between Ivy doc and Sbt, help understand the all idea. 
Reply all
Reply to author
Forward
0 new messages