1

I have a multi module sbt project. When I change some source code in a module, other modules don't see the changes in IntelliJ . When I try to navigate, it goes to declaration, instead of navigating to the source it navigates to compiled jar file.

It works fine when I remove the jar from library dependencies in project settings. I think because it recompiles so works fine till next change. And sbt compiles works fine but I guess problem because of Build.scala settings, project dependencies can have order issues. Here is the dependencies;

lazy val root = Project(id = "xx-main", base = file("."), settings = commonSettings)
    .aggregate(utils, models, commons, dao, te)
    .dependsOn(utils, models, commons, dao)

lazy val utils = Project(id = "xx-utils", base = file("xx-utils"))
  .settings(commonSettings: _*)

lazy val commons = Project(id = "xx-commons", base = file("xx-commons"))
  .settings(commonSettings: _*)
  .dependsOn(utils, models)

lazy val models =
  Project(id = "xx-models", base = file("xx-models"), settings = commonSettings)
    .dependsOn(utils)

lazy val dao = Project(id = "xx-dao", base = file("xx-dao"))
  .settings(commonSettings: _*)
  .dependsOn(utils, models)

lazy val te = Project(id = "xx-te", base = file("xx-te"))
  .settings(commonSettings: _*)
  .dependsOn(utils, models, dao, commons)
Ömer Erden
  • 7,680
  • 5
  • 36
  • 45
Fatih Donmez
  • 4,319
  • 3
  • 33
  • 45
  • This is because of duplications between `aggregate` and `dependsOn` in your root project. – dk14 Oct 22 '16 at 10:09
  • It makes sbt recognizing `dependsOn` as external dependency for some reason – dk14 Oct 22 '16 at 10:09
  • 1
    I already have an answer about that (somewhere) but can't find it, so I meanwhile this might help: http://stackoverflow.com/questions/26477388/is-the-use-of-aggregate-following-by-dependson-redundant-with-the-same-modul – dk14 Oct 22 '16 at 10:10
  • Thanks @dk14, can you elaborate the difference between aggregate and depends on. It looks like I have fundamental misunderstanding. – Fatih Donmez Oct 22 '16 at 10:11
  • 1
    I think your understanding is fine, this is just a strange behaviour of sbt/intellijIdea. Here is the related question: http://stackoverflow.com/questions/25972466/sbt-0-13-1-multi-project-module-not-found-when-i-change-the-sbt-default-scala-li – dk14 Oct 22 '16 at 10:14
  • 1
    note that my answer on that question doesn't cover the whole problem (but both answers might lead you to solution), there is a better answer there – dk14 Oct 22 '16 at 10:15

0 Answers0