Previously we had an introduction to sbt, its default tasks and how to add extra tasks.
Play comes with the sbt console. The SBT console is a development console based on sbt that allows you to manage a Play application’s complete development cycle.
Let us create a play application using sbt and see the commands provided.
sbt new playframework/play-scala-seed.g8 [warn] Executing in batch mode. [warn] For better performance, hit [ENTER] to switch to interactive mode, or [warn] consider launching sbt without any commands, or explicitly passing 'shell' [info] Set current project to development (in build file:/home/gkatzioura/Development/) This template generates a Play Scala project name [play-scala-seed]: PlayExample organization [com.example]: com.gkatzioura scala_version [2.11.11]: play_version [2.5.14]: scalatestplusplay_version [2.0.0]:
The result is a play project named playexample. By opening with an editor the project/plugins.sbt we can see the sbt plugin added to our project.
Therefore we are going to check what are the extra tasks that the sbt plugin provides and some tasks that can be generally helpful.
cd playexample; sbt [PlayExample] $ <tab><tab> Display all 511 possibilities? (y or n) ... h2-browser ... playStop playUpdateSecret playGenerateSecret ... stage ...
- playStop – Stop Play, if it has been started in non blocking mode
- playGenerateSecret – This will generate a new secret that you can use in your application. For example the application secret can be used for Signing session cookies and CSRF tokens or
built in encryption utilities
- playUpdateSecret – Update the application conf to generate an application secret
- stage – Create a local directory with all the files laid out as they would be in the final distribution.
- h2-browser – Opens an h2 database browser. Pretty useful if you are using h2 for development
Those are some of the commands that you might use often. However if you want extra information, you can always type help play.
[PlayExample] $ help play playExternalizeResources Whether resources should be externalized into the conf directory when Play is packaged as a distribution. playCommonClassloader The common classloader, is ... ...