Setup Play Framework 2.2 in Scala IDE for Eclipse 3.0

playframework

Heard that Twitter, Foursquare and Typetalk are running on Play Framework, written in Java and Scala. I’ll try it with Scala IDE for Eclipse which is installed on my MacBook Air.

Play Framework is an open source, makes it easy to build web applications with Java and Scala.

My setup is Mac OS X 10.9.2, Java 1.8.0_05, Scala 2.11, and Eclipse 4.2 (Juno) with Scala IDE 3.0.
If you don’t install Eclipse and Scala IDE, read Setting up Scala IDE for Eclipse.

Let’s Play!

 

Installing Play Framework 2.2 on Mac

Run this command.

brew install play

 

Installing the Play2 support in Scala IDE

Open installing new software window.
Screen Shot 2014-04-22 at 10.16.35 PMThen, select the download site of Scala IDE, check the Play2 support in Scala IDE, and go to the next screens to validate the plug-in to install. Accept the License, and start the installation.

 

Creating new Simple Scala Web Application on Play Framework

Run play command.

play new simpleApp

Screen Shot 2014-04-22 at 10.39.47 PM
Some source codes are generated. Change directory to the simpleApp, and launch Play.

cd simpleApp
play

Screen Shot 2014-04-22 at 10.47.33 PM
Then, run the app on Play.
Screen Shot 2014-04-22 at 10.52.21 PM
Congrats! The application starts to work, check it: http://localhost:9000. And you can stop the application using ctrl-d.
Screen Shot 2014-04-23 at 9.13.11 AM

 

Generate configuration for Scala IDE for Eclipse

Run ‘eclipse’ command in Play.
Screen Shot 2014-04-23 at 11.42.41 AM
Start the application as a auto-reloading mode, using ~ run.
Screen Shot 2014-04-23 at 1.34.07 PM

 

Setting up Scala IDE and Import the Web Application

Open a preference of Eclipse, and configure your Eclipse. Check “Refresh using native hooks of pooling”.
Screen Shot 2014-04-23 at 9.36.32 AM
Import the web application, Click “File” from Eclipse’s menu bar, and select “Import”.
Select “Existing Projects into Workspace” on the Import Screen.
Screen Shot 2014-04-23 at 1.50.56 PM
Then, fill with your application root path which is you run the command “play new simple App”, go to finish.
Screen Shot 2014-04-23 at 1.57.14 PM
Eclipse imports the web application as a project.
Screen Shot 2014-04-23 at 2.22.32 PM
Here we go, what kind of web application do you make?