I want to work on multiple sbt-projects at the same time in intellij. The projects are "one way dependent", meaning that one is the (reusable) core and the other is an actual application built upon that core. Both are currently in development.
I want the core to reside in another base/root-directory than the application, so:
- /core
-- build.sbt
- /application
-- build.sbt
I want to be able to
- modify both projects in the same IntelliJ-window
- leave both projects in their respective folder (no wrapper-folder around them!). Core will be used in other applications as well, applications that are no siblings to the current "application", so I do not want them to reside under the same root-folder!
What I've tried and which problems I've found so far:
setups like
lazy val core = project.in(file("../core"))
lazy val application = project.in(file(".")).dependsOn(core)
are not working, because an sbt asserts that the directory of each project in a multi-project-setup are contained in the same build root:
sbt java.lang.AssertionError: assertion failed: Directory /core is not contained in build root /application
setups like
lazy val core = RootProject(file("../core"))
lazy val application = project.in(file(".")).dependsOn(core)
are not a solution because:
- I can not have both projects in one IntelliJ-window then
- Strangely the classes of core are not found in application, although the imports worked right away
Now I am a sbt-newbie and I guess (and hope) that there must be a solution for this problem. I can't be the only one wanting to separate my projects without a wrapper-layer and still be able to modify them in the IDE of my choice.
edit:
@OlegRudenko´s solution is semi-working for me. As core
has some dependencies as well, I cannot compile or work with it in application
.
core
pulls in some dependencies like e.g. a Logger and when I'm in application
and try to use a component of core
the compiler screams at me, because it can't find the dependencies in core
(e.g. the logger).
Also, core
pulls in e.g. lwjgl and I want to use some components of it in application
, no chance, because it can't find the packages for that dependency of core
.
For now what I do is a hacky non-solution. I just develop both core
and application
in the same intellij-project and keep the git-repo private.
This is not a solution at all, as I want to open source core
while application
is closed source for now and I still want to work on both at the same time, refine the core
etc.
core
, which will be kept at its original place. Can you do so? – Discovertgit submodule
helping with my (separated) directory-structure? – Disproportion