You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
While I was trying to clean-up a repository, I ran into an issue. First of all, let me say that this repo/project structure is a bit weird one(unlike the normal project/apps ) since it is a tutorial repo where different ppl have created sample modules and independent projects and grouped them in different directories.
In this, the root build.sbt, defines a project just to aggregate grouping modules by adding a (project in ..).
In the grouping/build.sbt, it adds the projects for each of its sub-modules but using the format:
lazy val mod1 = (project in file("mod1"))
lazy val mod2 = (project in file("mod2"))
When we compile the entire module, it compiles only grouping/mod2 code only since it is defined 2nd in the grouping/build.sbt. If I reverse the order f defn, it compiles mod1.
I understand it due to this weird structure and the usage of file(".") in the grouping/mod2/build.sbt. I believe this overrides the project definition when the build files are combined together.
So, this is my doubt.
Is it possible to show error or warning when there is an override happening? I know this case I showed is very weird and not generally used. Nevertheless, the accident usage of this pattern might have ppl wondering why a module is not compiling.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
While I was trying to clean-up a repository, I ran into an issue. First of all, let me say that this repo/project structure is a bit weird one(unlike the normal project/apps ) since it is a tutorial repo where different ppl have created sample modules and independent projects and grouped them in different directories.
Now let me explain the situation:
In this, the root build.sbt, defines a project just to aggregate grouping modules by adding a
(project in ..)
.In the
grouping/build.sbt
, it adds the projects for each of its sub-modules but using the format:When we compile the entire module, it compiles only
grouping/mod2
code only since it is defined 2nd in thegrouping/build.sbt
. If I reverse the order f defn, it compilesmod1
.I understand it due to this weird structure and the usage of
file(".")
in thegrouping/mod2/build.sbt
. I believe this overrides the project definition when the build files are combined together.So, this is my doubt.
Is it possible to show error or warning when there is an override happening? I know this case I showed is very weird and not generally used. Nevertheless, the accident usage of this pattern might have ppl wondering why a module is not compiling.
For reference, I created a sample repo here: https://github.com/yadavan88/weird-sbt-sample
Thanks in advance
Yadu
Beta Was this translation helpful? Give feedback.
All reactions