How get application version in play framework and build.sbt

你。 提交于 2019-11-28 10:16:58

I've added this to my build.sbt:

import com.typesafe.config._

val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()

version := conf.getString("app.version")

and in my application.conf:

app.version="0.2-SNAPSHOT"
biesior

Take a look at the solution using the application.conf to keep version info (you must to modify it to fit 2.2 build file): Play Framework 2: Read the application version defined in Build.scala

When you have it in application.conf you can read it easily in your controller.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!