4

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?

Community
  • 1
  • 1
biesior
  • 55,576
  • 10
  • 125
  • 182
  • I don't think you can easily disable the prefixes and logging info. I would use a shell script to extract the name and version from the output. – kapex Jan 15 '14 at 14:46
  • 1
    @kapep Thx for info, I'm afraid that won't work especially when using for many instances/apps. For now I'm finding `myapp-1.2.3.zip` as an only file in `dist` so I can use it for further processing, anyway it would be nice to get other data from play console :) – biesior Jan 15 '14 at 15:42

1 Answers1

5

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?

Community
  • 1
  • 1
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420