Open pbassiner opened 7 years ago
Hey, great article. I noticed that this is a nice way to do single degree project dependencies within sbt. But what if you had a 2 degree dependency? For example, what if it was common -> multi1 -> multi2 instead of common -> multi1; common -> multi2? I tried doing this with my own code, and I realized I needed to do (multi1.dependsOn(common), and multi2.dependsOn(common, multi1). It fails if I just do multi2.dependsOn(multi1). In this case, it tries to find common in maven, even though it's a project in my folder structure. Do you know a more elegant way to solve this?
Hi @wayoung, Thanks, I'm glad you find it useful.
I've tried myself to make multi2 depend on multi1 instead of common and I don't see any fetching from maven. Actually, after cleaning the whole project, compiling only multi2 actually triggers the compilation of common and multi1 in the proper order.
Great article! Very useful - Many thanks!!!
In the artifacts generation section, is there a way to generate artifacts only for multi1
or multi2
at a given time but not both together?
Hi @Sparker0i,
you can either have specific assembly settings in each project instead of a single one in the parent one, or you can disable the plugin in a specific subproject using .disablePlugins(sbtassembly.AssemblyPlugin)
.
If you need to generate both but not at the same time, you can run sbt commands only for a subproject navigating first into it (project multi1
, in sbt 1.x).
That said, bear in mind that this post is already 4 years old so, even this still works, there might be changes or improvements in sbt or the plugins.
Here you can leave your comments about the blogpost https://pbassiner.github.io/blog/defining_multi-project_builds_with_sbt.html