0

I have a scala play application; I am trying to expose health check for our service. Part of the health check I would like to capture the project artifact version.

Can I know how I can reference project artifact version from health check controller in play application. We are making use of sbt for the build.

sample sbt file

import root.sbt.Keys._ import com.typesafe.sbt.SbtNativePackager._ import NativePackagerKeys._ import play.PlayScala

name := "artifact-name"

version := "0.5"

scalaVersion := "2.11.1"

javacOptions ++= Seq("-source", "1.7", "-target", "1.7")

scalacOptions += "-target:jvm-1.7"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

Michael Zajac
  • 53,182
  • 7
  • 105
  • 130
Laxmikanth Samudrala
  • 2,063
  • 4
  • 24
  • 42
  • seem's similar question is already posted; I got the answer from here http://stackoverflow.com/questions/8957025/sbt-including-the-version-number-in-a-program – Laxmikanth Samudrala Feb 23 '15 at 21:00

1 Answers1

1

The xsbt-reflect plugin gives you access to the SBT variables at runtime.

All you need to do inside of your health route is return

Reflect.version
JakeWilson801
  • 1,036
  • 7
  • 20