Play framework with Scala – Getting Started
Play is a web framework based on JVM languages including Scala and Java. This post is about getting you up running a basic Hello world application with Scala using IntelliJ IDEA.
Download IntelliJ IDEA
IntelliJ IDEA can be downloaded from JetBrains. Here is the download link:
Downloading Activator
There are many example projects and templates available for scala. The same is true for Play framework. There are myriads of demos available for checking out how a particular feature needs to be implemented. They also enable us to seed a project saving the setup time.
There are activators available from different providers including Lightbend. These activators allow us to download these templates and demos. Let’s download an activator from LightBend to seed our play project.
or we can download these templates directly.
There are three tasks you can do with activator. They are as follows:
- Running activator UI (./activator ui)
- Listing available templates (./activator list-templates)
- Creating new project based on a particular template (./activator new {TEMPLATE_NAME})
If you want to go to the activator route, then you can look for templates using list-templates switch. And then you can create a new project based on the template of your choice using new switch.
This creates a project in the selected folder.
We can open this in the IntelliJ IDE downloaded earlier. Here are the contents of the folder for created project.
As you can notice there are files more than the project files themselves. Please note the activator. This allows us to build and run play from the terminal easily. Here we are using activator to run our play project. This would use the default netty server to host the project.
And here is how the default page for the project.