如何在 play framework 和 build.sbt 中获取应用程序版本 [英] How get application version in play framework and build.sbt
本文介绍了如何在 play framework 和 build.sbt 中获取应用程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Scala 中使用 play 2.2,如何从 build.sbt 获取版本?
I'm using play 2.2 with Scala, how can I get version from build.sbt?
name := "project_name"
version := "0.2-SNAPSHOT"
play.Project.playScalaSettings
或者我怎样才能从另一个对象那里传递值?
or how can I pass there value from another object?
推荐答案
我已将此添加到我的 build.sbt 中:
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")
在我的 application.conf 中:
and in my application.conf:
app.version="0.2-SNAPSHOT"
这篇关于如何在 play framework 和 build.sbt 中获取应用程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文