You should be able to use Play as any other jar dependency. A sample project using some parts of Play (you should change the Play and Scala versions to match your needs):
$ tree .
├── build.sbt
└── hello.scala
The build.sbt file:
name := "hello"
version := "1.0"
scalaVersion := "2.10.4"
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play" % "2.3.4",
"com.typesafe.play" %% "play-test" % "2.3.4"
)
And hello.scala
import play.api._
import play.api.mvc._
import play.api.test._
import play.api.test.Helpers._
class TestController extends Controller {
def index = TODO
}
object Hello {
def main(args: Array[String]) = {
Logger.error("Using Play logger")
val fr: FakeRequest[String] = new FakeRequest(
"GET", "/",
FakeHeaders(Seq.empty), ""
)
val ctrl = new TestController
// Prints the response body
println(contentAsString(call(ctrl.index, fr)))
println("Done")
}
}
This should give you something like this:
$ sbt run
(...)
14:00:12.335 [run-main-0] ERROR application - Using Play logger
<!DOCTYPE html>
<html>
(...)
<body>
<h1>TODO</h1>
<p id="detail">
Action not implemented yet.
</p>
</body>
</html>
Done