Assuming that A
and B
are completely separate builds (it's not just multi-project build as you have several .sbt
files), it's possible only if your A
build is physically placed inside B
.
1) If you need A-sources to be available to B-sources:
- B
- build.sbt
- A
- build.sbt
build.sbt
then you may describe A
's sources as some regular B
's project , like:
B/build.sbt
lazy val a = project in "./A" // or deeply if your sources not in A's root
lazy val b = project in "." dependsOn a
B/A/build.sbt (if you really need separate build here)
lazy val a = project in "."
You may want to share some plugin with source-path-independent project definition between A
and B
then, like:
def a(base: String) = Project(base = base, settings = someAsettings)
You may organize such structure with a symlink (Linux/Mac):
ln -s ../B A
Otherwise you will need to manually publish A
(publishLocal
) to your local ivy repository and use it as external dependency.
If you use Git - symlinks should be fine as long as participants are using same OS. Another solution is git submodules or subtree.
2) If you need the code from A-sources to be available inside B-build (not B-sources) then you need a structure like this:
- B
- build.sbt
- project
- project
- A
build.sbt
Project inside project actually becomes an sbt-plugin, so its code is available to B.
If you don't want to change the structure then A
should became an sbt-plugin
and you need to publish it to the local repository.