How to get application name and version only on command line in Play 2.1

playframework, playframework-2.1, sbt

Solution

I use SBT 0.13 that's only available since Play 2.2 so your mileage may vary.

In `build.sbt` define a task that prints out the `version` setting.

lazy val showVersion = taskKey[Unit]("Show version")

showVersion := {
  println(version.value)
}

Tweak it to include other settings like `normalizedName` (aka `normalized-name`).

With the `showVersion` task, run the following command to get the version:

$ play --error 'set showSuccess := false' showVersion
0.1-SNAPSHOT

You may want to add `showSuccess := false` to `build.sbt` to make the command shorter - see How to turn off info and success messages in sbt?

Problem

According to this nice trick I'm setting version and after command `play normalized-name version` in console get the output like ``` [info] Loading project definition from /www/apps/MyApp/project [info] Set current project to MyApp (in build file:/www/apps/MyApp/) [info] myapp [info] 1.2.3 ``` Anyway for deployment automatization I'd need to get only concated values like `myapp-1.2.3` or at least only value `myapp` and `1.2.3` (without Loading info [info] prefixes) how can I do this?

Original source

Related problems