How to set arguments through the command line in SBT

Published on:

Suppose you want to provide externally some setting in SBT.

You could create an input task or you can set setting from the command line.

Now, let's explain how to do the 2nd choice.

Suppose you have this in your build.sbt file:

val buildNumber = settingKey[Int]("Build number")
// Provide some default value
buildNumber := 0

Then from e.g. Jenkins, you could set the build number in this way:

sbt "set buildNumber:=5" "show buildNumber"

In this example we have shown its current value, but we could you something more practical like package.

Comments

comments powered by Disqus