Documentation

You are viewing the documentation for the 2.1.3 release in the 2.1.x series of releases. The latest stable release series is 3.0.x.

§The Build System

The Play build system is based on sbt, a minimally non-intrusive build tool for Scala and Java projects.

§The /project directory

All the build configuration is stored in the project directory. This folder contains 3 main files:

Note that build.properties and plugins.sbt have to be manually updated when you are changing the play version.

§Default build for a Play 2.0 application

The default build description generated by the play new command looks like this:

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

  val appName         = "Your application"
  val appVersion      = "1.0"

  val appDependencies = Seq(
    // Add your project dependencies here,
  )

  val main = PlayProject(
    appName, appVersion, appDependencies, mainLang = SCALA
  ).settings(
    // Add your own project settings here      
  )

}

It is written this way to make it easy to define standard options like application name, version and dependencies.

Note that every sbt feature is available in a Play 2.0 project.

§Play plugin for sbt

The Play console and all development features like live reloading are implemented via a sbt plugin. It is registred in the plugins.sbt file:

addSbtPlugin("play" % "sbt-plugin" % "2.0")

You might need to add the Typesafe repository in your list of resolvers, see : http://github.com/playframework/Play20/wiki/Repositories

§Adding dependencies and resolvers

Adding dependencies is simple:

val appDependencies = Seq(
  "group" % "name" % "version number",
)

So is adding resolvers:

val main = PlayProject(
  appName, appVersion, appDependencies, mainLang = SCALA
).settings(
  // Add custom repository: 
  resolvers += "Repository name" at "http://url.to/repository" 
)

Next: About SBT Settings