harrah/xsbt — Issue #291: Feature request: Allow resolve libraryDependencies from other project of a Multi-Project Builds.
Author: Atry
Created: 2011-12-09 19:09:02+00:00
State: open

I maintain an open source project `foo`, which uses another project `bar`. Both of the two projects are used by a private project `baz`. I have directory layout like this:

* root/
* project/
* Build.scala
* foo/
* project/
* Build.scala
* build.sbt
* bar/
* build.sbt
* baz/
* build.sbt

I add `libraryDependencies` in `foo/build.sbt`:

```
libraryDependencies += "org.bazGroup" %% "bar" % "1.0"
```

This is necessary because foo is a solid project. Users of `foo` can checkout its source and run sbt, then the baz is automatically downloaded.

But I have a forked version of `bar`. I expect to aggregate `foo`, `bar` and `baz` together, and frequently modify all the three projects. So I write `root/project/Build.scala`:

```scala
import sbt._
import Keys._

object RootBuild extends Build {

lazy val foo = Project(id = "foo", base = file("foo")).aggregate(bar)

lazy val bar = Project(id = "bar", base = file("bar"))

lazy val baz = Project(id = "baz", base = file("baz")).aggregate(foo, bar)

}
```

But It does not work. There are two problem:

1. `foo/project/Build.scala` is ignored.
2. `"org.bazGroup" %% "bar" % "1.0"` does not resolved to my forked version of bar, instead, it uses the one in repository.

The second problem is even more terrible than maven. Maven's [Multiple Modules](http://maven.apache.org/pom.html#Aggregation) can resolve dependencies between sub-modules.