Reputation: 2826
In the build.sbt definition of a Scala project, is it possible to define the minimum version of sbt that is required to build the project?
Upvotes: 20
Views: 19194
Reputation: 22374
project/build.properties
allows you to force sbt to use particular version. If current version of installed sbt is different - sbt itself will download (if needed) the version you've specified there:
sbt.version=0.12.0
See, Hello for instance. So actually you may have installed several versions of sbt in your system - it's just jars, that placed in .sbt/boot/scala-{scala.version required by this sbt}/org.scala-sbt/sbt/{sbt.version}
folder. Sbt executable actually looks for version specified in project/build.properties
or (if it's not specified) highest version installed in the system.
P.S. From sbt-launcher
perspective, sbt is only one dependency with small non-intersecting others like ansi.jar
, so specifying the range of versions like [0.13.1, 0.13.8]
have no much sense as it would be efective only for conflicting transitive deps. Otherwise it's enough to specify higher possible version (which would compile) - you may even choose some version that you already have (and update project's sbt that way).
Upvotes: 28