In my Play
project I notice that build.properties
has sbt
version addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12")
and build.properties
has sbt.version=0.13.15
.
1) Why are there two enteries? 2) What is the difference between them 3) Should their versions be different?
There is a difference between SBT proper and SBT plugin. Play Framework is an SBT plugin. The version of SBT is specified in
project/build.properties
:whilst the version of Play SBT plugin is specified in
project/plugins.sbt
:Scala Play SBT plugin (
PlayScala
) is enabled inbuild.sbt
like so:SBT plugins enrich build definitions with additional useful tasks, commands, settings, and dependencies. Here are some examples from Play SBT plugin:
So for example to change the default port that Play runs on we can define in
build.sbt
:Note when upgrading SBT version we need to make sure it is compatible with corresponding Play SBT plugin. For example, to use Play with SBT 1 we need to update Play
sbt-plugin
to2.6.6
.SBT plugin best practice artifact naming convention encurages the following naming scheme:
For example,
sbt-scoverage
,sbt-buildinfo
,sbt-release
,sbt-assembly
, however Play named itsbt-plugin
, which arguably can be confusing.