I'm new to sbt and I've been trying to set up a multi-project with it but to no avail.
I've searched and came up with relevant info but was unable to set things up so that it will work.
Here's the structure that I have:
- Shared project
- ProjectOne
- ProjectTwo
Each project has it's own build.sbt
at it's root.
ProjectOne
and ProjectTwo
are "real" projects while the Shared
one just contains utils that both of the other projects need, think of it as a library that they both use.
The "real" projects don't depend on each other.
Here's the latest build.sbt
I have in ProjectOne
:
name := "project-one"
version := "1.0"
scalaVersion := "2.11.8"
lazy val projectone = (project in file(".")).aggregate(shared)
lazy val shared = RootProject(file("../Shared"))
This works only in that I can see the shared project in my SBT projects
view in IntelliJ:
- projectone (root)
- projectone-build
- shared
- shared-build
But when I try to use classes from shared intellij can't find it and asks me to
Add dependency on module 'Shared'
If I choose that then it's fine, but if I change the build.sbt
file then this dependency goes away.
Also, when I try to run the project using typesafe-activator it fails to find the classes in the shared project.
So the question is how to add the dependency on Shared
in the other projects?
Also, does the answer change if Shared
isn't a sbt project? I might remove the need to use sbt with the shared module.
Thanks