pbassiner / pbassiner.github.io

Personal Blog
https://pbassiner.github.io
MIT License
1 stars 1 forks source link

Comments on post "Defining Multi-project Builds with sbt" #53

Open pbassiner opened 7 years ago

pbassiner commented 7 years ago

Here you can leave your comments about the blogpost https://pbassiner.github.io/blog/defining_multi-project_builds_with_sbt.html

wayoung commented 6 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?

pbassiner commented 6 years ago

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.

atulkSq1 commented 6 years ago

Great article! Very useful - Many thanks!!!

Sparker0i commented 2 years ago

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?

pbassiner commented 2 years ago

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.