Search code examples
sbtsbt-assembly

Inserting implementation version to manifest using sbt


I saw here that it is possible to manually insert specific fields to the manifest:

name := "project"
version := "2.3.5"

packageOptions := Seq(Package.ManifestAttributes(
                     ("Implementation-Version", "2.3.5")))

I would like to use version directly, without recopying the version number.

Putting version instead of "2.3.5" gives an error. Can I somehow use version directly, without recopying the version number?


Solution

  • Get the value of a setting by calling .value on it like so

    packageOptions := Seq(
      Package.ManifestAttributes(("Implementation-Version", version.value))
    )
    

    In general, value can be called in the following scenarios:

    value can only be used within a task or setting macro, such as :=, +=, ++=, Def.task, or Def.setting."