Although Play also uses sbt to build an application but building a Spark Application in Play is totally different.
Before start building this application follow the instructions of building Spark given here.
After building Spark, we are ready to build the Application. To build the application follow these steps:
1). Run play new PlaySparkApp.
This will create a new Play application.
2). Add following dependencies in build.sbt file
Although, Akka is inbuilt in Spark & Play both but due to mismatch of Akka versions in Play & Spark, application will not build properly. So, a common version of Akka is added in the application.
3). Add these lines in Application.scala file
This is just a demo application in Spark. You can build any application of Spark here.
4). Then go to PlaySparkApp directory.
5). Run play clean compile dist
6). Run play run
The application is ready to be displayed on localhost:9000.
To download a Demo Application click here.
Note: Whenever a change is made in the application, then run play dist command otherwise changes in the Spark files/functions will be not be reflected.