Mike Allen
Mike Allen

Reputation: 8269

Access SBT version within build?

I'd like to add a package manifest attribute to my project's jar file that documents the version of SBT that generated it. However, I can't seem to find any way to access SBT's version from within the build file.

I tried using scala.util.Properties.propOrElse ("sbt.version", "dunno") but I get "dunno" as the answer.

Upvotes: 1

Views: 77

Answers (1)

lpiepiora
lpiepiora

Reputation: 13749

You can use sbtVersion setting, which according to the description

Provides the version of sbt.

You can get the actual value via sbtVersion.value.

Please note you can access it only inside the task or setting macro, but if you're modifying a Manifest attribute you're very likely already doing so.

Upvotes: 2

Related Questions