-
Notifications
You must be signed in to change notification settings - Fork 951
Support Maven's BOM "Bill of Materials" #4531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
With Maven's BOM you can also rule how plugins work across projects and subprojects. The BOM file enables developers to centralize plugins configuration and dependencies in only one place. It is great when you work in a big company with many projects and you need to govern common plugins and dependencies across your whole organization. |
In sbt/librarymanagement#293 @LogicalTime wrote
|
I'd like to work on this one.
Am I missing something? |
In Maven, importing a BOM also overrides versions in transitive dependencies:
https://docs.gradle.org/current/userguide/platforms.html#sub:bom_import @simpadjo Thank you for taking this. Would this fit in sbt's behavior? |
@suztomo no, my proposal is quite minimalistic: make possible to set dependency version to mach another artifact's dependency version. It even doesn't need to be a BOM. |
If a project is using actual Maven to manage their build, the idea of parent POM / BOM (Bill of Materials) might make sense as a way of keeping things DRY (don't-repeat-yourself). For sbt, I don't see a huge benefit in emulating this contraption because you can already use Should someone try to implement non-effective POM dependency, note that the actual work would likely need to happen in Coursier to represent the version-less dependency. Given that Coursier is able to resolve Maven ecosystem, its dependency resolver is likely able to handle it, but I am not sure how difficult it would be to model versionless direct dependency. |
@eed3si9n thanks for you input! Yeah, the issue is more complicated than I initially thought. Right now I'm trying to implement this functionality as a library that could possibly become a plugin. |
This is an example how to get BOM functionality With this code, the following syntax works:
I plan to polish this with the help of my coworkers and eventually publish it (from my company's account). But this is not a fast process, you know. |
BOMs allow to align external transitive dependency versions. For example with Akka there is a common problem when versions are misaligned because of different transitive dependencies. When project uses Also, in my practice quite often there are several independent projects which require to repeat the same exercise again. |
(+1) |
Better late than never: plugin for BOM support was finally opensourced. |
|
sbt still does not have:
so while sbt 1.10.6 improves the dependency resolution that involves BOM, there are some tasks pending until we can support bill-of-materials (BOM) POM. |
I have upgraded SBT to 1.10.6 and added a bom file (both using libraryDependencies and dependencyOverrides, with and without pomOnly()) and it is ignored in all cases. When I run This is my little test project:
|
@UnaiUribarri-TomTom , read the previous comment:
It's not supported yet. You can use the SBT plugin https://github.com/heremaps/here-sbt-bom to do so though. EDIT: this thread contain some answers. |
@gaeljw is right; SBT does not pass BOM dependencies to courier correctly; therefore, no direct BOM dependency support yet. For now, SBT only supports BOM as a transitive dependency, when its parent package is not built using SBT, but Maven, Gradle or other build system that supports BOMs. |
Uh oh!
There was an error while loading. Please reload this page.
It would help scala's ecosystem if sbt supported Maven's BOM "Bill of Materials" that (IIUC) would help maintain version coherence across artefacts of the same project.
One current workaround is verifying this at runtime like Akka does: https://github.com/akka/akka/blob/v2.5.17/akka-actor/src/main/scala/akka/util/ManifestInfo.scala
The text was updated successfully, but these errors were encountered: