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 ... ...
| Reference: | Play and SBT basics from our JCG partner Emmanouil Gkatziouras at the gkatzioura blog. |
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Thank you!
We will contact you soon.
Tags
Play Framework Sbt
👁 Photo of Emmanouil Gkatziouras
Emmanouil GkatziourasMay 3rd, 2017Last Updated: May 2nd, 2017
Emmanouil GkatziourasMay 3rd, 2017Last Updated: May 2nd, 2017
0 120 1 minute read

This site uses Akismet to reduce spam. Learn how your comment data is processed.