How get application version in play framework and build.sbt

后端 未结 2 1755
耶瑟儿~
耶瑟儿~ 2020-12-10 07:28

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
         


        
2条回答
  •  生来不讨喜
    2020-12-10 07:58

    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.

提交回复
热议问题