The Build System
The Play build system is sbt, a non-intrusive build tool for Scala and Java projects.
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
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
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % playVersion) // where version is the current Play version, i.e. playVersion := "2.2.0"
plugins.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
Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request.