How to find out which Play version I'm using?

ScalaPlayframeworkTypesafe Activator

Scala Problem Overview


Kinda silly question, but I used Activator to get started with the play framework, and now need to see what version I'm using. 2.3 came out with support for docker, but when I put

dockerExposedPorts in Docker := Seq(9000, 9443)

in my build.sbt, it complains it doesn't know what dockerExposedPorts is, so I'm thinking I might be running 2.2.

Scala Solutions


Solution 1 - Scala

Type playVersion within the activator console.

Alternatively you can look in project/plugins.sbt for the line

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.2")

In this example, the play version is 2.3.2

Solution 2 - Scala

I use the following to list and highlight all play versions in a play project. Works for a multi-module project as well.

The following was tested on macOS Sierra using the default BSD find that it comes with and GNU grep installed via brew install grep. The latter is required since the following command requires a grep that supports Perl regex (which BSD grep does not).

You can check if the grep on your PATH has Perl-regex support by doing this (should show that the -P option is available):

    $ ggrep --help | grep -i Perl
  -P, --perl-regexp         PATTERN is a Perl regular expression

(ggrep is the GNU grep installed via Homebrew)

And now, on to the actual command (note the ggrep in the command):

   $ find . -name "plugins.sbt" -exec ggrep -PHin --color=always 'com.typesafe.play.*sbt-plugin.*%\s*"\K.*?(?=")' {} \;

which outputs: enter image description here

Quick notes about the grep options (extracted from grep help):

  -P, --perl-regexp         PATTERN is a Perl regular expression
  -i, --ignore-case         ignore case distinctions
  -n, --line-number         print line number with output lines
  -H, --with-filename       print file name with output lines

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjoslinmView Question on Stackoverflow
Solution 1 - ScalaJames DaviesView Answer on Stackoverflow
Solution 2 - ScalaAshutosh JindalView Answer on Stackoverflow