§The Build System
The Play build system is sbt, a non-intrusive build tool for Scala and Java projects.
§The /project directory
Build configuration is declared in your project’s build.sbt file and in your project’s /project folder. The project folder contains 2 main files:
build.properties: This is a marker file that declares the sbt version used.plugins.sbt: SBT plugins used by the project build including Play itself.
§Default build for a Play application
The default build description generated by the play new command looks like this:
import play.Project._
name := "Your application"
version := "1.0"
playScalaSettings
playScalaSettings or playJavaSettings is specified to configure sbt for Scala or Java respectively.
Every sbt feature is available to a Play project.
§Play plugin for sbt
The Play console and all of its development features like live reloading are implemented via an sbt plugin. It is registered in the plugins.sbt file:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % playVersion) // where version is the current Play version, i.e. playVersion := "2.2.0"
Note that
build.propertiesandplugins.sbthave to be manually updated when you are changing the play version.
§Adding dependencies and resolvers
Adding dependencies is simple as the build file for the zentasks Java sample shows:
import play.Project._
name := "zentask"
version := "1.0"
libraryDependencies ++= Seq(javaJdbc, javaEbean)
playJavaSettings
…and so are resolvers for adding in additional repositories:
resolvers += "Repository name" at "http://url.to/repository"
Next: About SBT Settings