I use the Play Framework 2.0 (2.0.3).
I have a Java project and want to read the application version (appVersion) defined in Build.scala.
What I already
I use the SBT BuildInfo plugin for this purpose:
import sbtbuildinfo.Plugin._
val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA, settings = Defaults.defaultSettings ++ buildInfoSettings).settings(
buildInfoKeys := Seq[Scoped](name, appVersion, scalaVersion, sbtVersion),
buildInfoPackage := "org.foo.bar",
...
)
This generates an org.foo.bar.BuildInfo object which you can then call from the source code:
org.foo.bar.BuildInfo.version
You can also define custom keys in the build and add them to the buildInfoKeys, which is quite useful if your build gets more complex.