0
votes

I'm packaging multi-project sbt build with sbt package and have the following version property set in the build.sbt root:

version := "1.0.0"

But unfortunately the aggregated subprojects jar are all have 0.1.0-SNAPSHOT suffix unless I specify a version := for each of the subproject specifically. Is there a way to propagate the version := "1.0.0" set in the build.sbt root? Or any other way to set a version for all the aggregated subprojects?

I tried

lazy val root = project
  .in(file("."))
  .aggregate(
       //...
   )
  .settings(
    version := "1.0.0",
    //...
   )

But it didn't work.

1
Use ThisBuild / version := "1.0.0"Luis Miguel Mejía Suárez

1 Answers

1
votes

From Examples of scoped key notation in the sbt shell:

  • ThisBuild / version sets the subproject axis to “entire build” where the build is ThisBuild, with the default configuration.

Therefore, as @LuisMiguelMejíaSuárez mentioned in the comment, the following should do that:

ThisBuild / version := "1.0.0"
lazy val root = project
  .in(file("."))
  .aggregate(
       //...
   )
  .settings(
    //...
   )

In general, I'd recommend reading about Scopes in sbt.