0

I have a main sbt project which depends on two sbt subprojects, 'util', and 'common'. In addition the common project depends on the util project. In the build.sbt of the common project, how should I specify the dependency to the sibling project util, so that I can compile the common project independently?

Many thanks.

Azad

  • Please see the answer for [How to reference a local project in Scala](https://stackoverflow.com/q/50204934/432903) which might help. you can use `project.settings().dependsOn()` – prayagupa May 14 '18 at 00:48
  • Thanks prayagupd. The project you referenced has a root that 'aggregates' two children, one of which depends on the other and neither of which has its own build.sbt. In contrast, in my situation, I have a root that 'dependsOn' two children, one of which depends on the other and have their own build.sbt's. I'd like to be able to bring up sbt in either sub-project folder and be able to compile, etc. that child, as well as being able to compile, etc. the entire project from the root. The referenced child projects don't have build.sbt's, and it is unclear how to apply that sample to my case. – Azad Bolour May 14 '18 at 07:10
  • I think you will avoid the problem if you maintain just one `build.sbt` in the root project and switch to subprojects with `project ` command. – laughedelic May 14 '18 at 13:47
  • Thanks for the workaround. It is not exactly what I had hoped for. But it does address my problem. And I can even have build.sbt's in sub-projects. Still, I am curious to know if it is possible to refer to and to dependOn one sibling in another sibling's build.sbt (or Build.scala). I admit that the duplication of dependsOn in the child would not be ideal given that the dependsOn needs to provided in the root as well. Just interested in knowing the range of available options. Thanks again. Azad – Azad Bolour May 14 '18 at 17:25

0 Answers0