Digital Sanctum

Personal blog of Shane Witbeck Tags · Archive · About

Play Framework 2 Tutorial: Debugging with IntelliJ IDEA

A tutorial on how to debug Play Framework applications using the IntelliJ IDEA IDE

Published: 26 May 2012

In part one of this series of Play Framework tutorials, I outlined how to get a very simple Play Framework app up and running and deployed to Heroku.

In this post I’ll describe how to debug a Play Framework app using IntelliJ IDEA.

Here are the versions used for this post:

Create IDEA Project Files

There’s a single step from the Play console which will create the IDEA project files and setup your app’s classpath with the libraries it depends on.

From the root directory of your Play app…

play framework intellij idea screenshot

Note that if you change any of your projects dependencies, you’ll have to re-run the “idea” command.

IntelliJ IDEA New Project Setup

The following screenshot show the steps necessary to setup your new project and use the generated project files from the “idea” Play command above:

Start by creating a new project and unchecking the “Create module” checkbox:

play framework intellij idea screenshot

Choose “Import existing module” and select the *.iml file generated with the “idea” command from the Play console:

play framework intellij idea screenshot

You should see the “app” and “test” folders highlighted as seen below:

play framework intellij idea screenshot

You should also see several dependencies added to your app:

play framework intellij idea dependencies

IntelliJ IDEA Debugger Setup

Now that your Play Framework app is setup in IDEA let’s setup a Run/Debug configuration:

play framework intellij idea screenshot

Debugging with IDEA

To debug your application:

From the command prompt, run play debug and you should see something like the following:

play debug

play intellij idea breakpoint

Play Console in IntelliJ IDEA

Support for the Play Framework in IntelliJ IDEA is pretty basic as of this writing but you can run the Play console from IDEA via:

Tools > Play with Playframework...

Vote for Better Play Framework Support!

If you’d like to see better support for Play Framework 2.0 in IntelliJ IDEA, vote for it here: