supported play version is 2.0.x, 2.1.x and 2.2.x.
In addition, also support scala project.
| Version | Release Date | Description |
|---|---|---|
| 1.1 | 2013/04/08 | enhancement #5 #12 |
| 1.1.1 | 2013/09/18 | bug fixed #13 |
| 1.2 | 2014/01/10 | supported play 2.2.x |
| 1.3 | 2015/06/17 | CrossBuild Scala2.10/2.11 |
Edit file project/Build.scala or build.sbt
libraryDependencies ++= Seq(
"jp.furyu" %% "play-velocity-plugin" % "LATEST_VERSION"
)
Edit file conf/play.plugins
5000:jp.furyu.play.velocity.VelocityPlugin
import jp.furyu.play.velocity.mvc._
object YourController extends Controller {
def index = Action {
Ok(VM("vm/index.vm", Map("name" -> "__name__", "title" -> "__title__")))
}
}
<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
</head>
<body>
$name
</body>
</html>
Plugin load velocity.properties in velocity.jar.
If customize its settings, add file velocity_plugin.properties and edit any settings.
Velocity don't support Scala's Map and List usually.
If you want to use, please set the following in your project.
runtime.introspector.uberspect = jp.furyu.play.velocity.ScalaUberspect
A sample application is available, to run it:
- clone the repository
- sbt or sbt.bat
- In sbt console, enter
project scala-sampleandrun - open a browser to localhost:9000