A sbt plugin to generate Bill of Materials (BOM) pom.xml for use with Maven or Gradle.
A BOM for a Scala project may either
- reference a single Scala minor version and create a BOM POM per Scala minor version, or choose to
- list all its artifacts for their Scala versions in a single BOM POM.
Artifacts that typically appear as libraries should use 1. to ensure dependencies do not mix Scala minor versions.
For frameworks which give the user a pre-defined set of dependencies approach 2. may appear simpler. Lagom has been using approach 2. for many years.
Add the sbt plug-in in project/plugins.sbt
addSbtPlugin("com.lightbend.sbt" % "sbt-bill-of-materials" % <latest>)
Create an sbt (sub-)project which will produce the BOM. list the sbt projects to include in the BOM as bomIncludeProjects
.
lazy val billOfMaterials = project
.enablePlugins(BillOfMaterialsPlugin)
.settings(
name := "sample-library-bom",
bomIncludeProjects := Seq(core, nonScala)
)
Create the BOM pom.xml files with:
sbt +billOfMaterials/publishM2
lazy val billOfMaterials = project
.enablePlugins(BillOfMaterialsPlugin)
.settings(
name := "framework-sample-bom",
// Just one BOM including all cross Scala versions
crossVersion := CrossVersion.disabled,
// Create BOM in the first run
crossScalaVersions := crossScalaVersions.value.take(1),
bomIncludeProjects := Seq(core)
)
Create the BOM pom.xml files with:
sbt billOfMaterials/publishM2
The bomIncludeModules
setting can be used with or without bomIncludeProjects
.
lazy val billOfMaterials = project
.enablePlugins(BillOfMaterialsPlugin)
.settings(
name := "framework-sample-bom",
bomIncludeModules := Seq("com.typesafe.akka" %% "akka-actor-typed" % "2.6.20"),
)
The license is Apache 2.0, see LICENSE.
The Akka team created this plugin to create Maven BOM POMs for parts of the Akka toolkit.
This project is community-maintained. Pull requests are very welcome –- thanks in advance! Contributors need to agree to the Lightbend Contributor License Agreement - CLA before we can merge a contribution.
Lightbend does not offer support for this project.