3
votes

I have a two sub-projects and top level project which agreegates them. I can successfully release all of them but only version on top level project is changed and sub-projects are released with the version defined in their directory which unfortunately is not changed during release.

Root
|
 -SubA
|   |- version.sbt -> version in SubA := "0.0.1-SNAPSHOT"
|
 -SubB
|   |- version.sbt -> version in SubB := "0.0.4-SNAPSHOT"
|- version.sbt -> version in ThisBuild := "0.1.0-SNAPSHOT"

After release I would like to have:

  • Root released as 0.1.0 (although I don't care about the root at all)
  • SubA released as 0.0.1
  • SubB released as 0.0.4

and each version is incremeted for example in SubA/version.sbt -> 0.0.2-SNAPSHOT

How can I do that using sbt 0.13 and sbt-release plugin?

2

2 Answers

7
votes

You need to override the default location of the version.sbt file in each build.sbt of your submodule:

import ReleaseKeys._

organization := "com.organization"

name := "moduleName"

version := (version in ThisBuild).value

scalaVersion := "2.11.6"

releaseSettings

versionFile := file(name.value + "/version.sbt")

By default, version.sbt is located at the ROOT folder by sbt-release.

0
votes

Make a separate class/object and define a commonSettings lazy val, and set the version := {your_docker_version) there (you can override this value in different ways e.g. via System.property etc.
Then use this commonSettings in all of your Modules.