Wednesday, 11 January 2012

Play! 2.0 in IntelliJ IDEA

Play! Framework 1.x supported creating an IntelliJ IDEA project by the command: play idealize.

However while Play! Framework 2.0 is in beta that command does not work**.

So how do you get your Play! 2.0 project to open in IntelliJ IDEA? There are few different work arounds. Especially regarding integrating sbt.

However I have a quick way. For this to work you need both Play! 2.0 and Play! 1.2.x installed.

Create Play! 2.0 project:
/usr/local/lib/play-2.0-beta/play new helloworld
(I am assuming it was a Java project that you chose)

Rename project folder:
mv helloworld helloworld2

Create Play! 1.x project:
/usr/local/lib/play-1.2.4/play new helloworld

Create IntelliJ project:
cd helloworld;
/usr/local/lib/play-1.2.4/play idealize


Move IntelliJ files to Play! 2.0 project:
cd ..;
mv helloworld/helloworld.i* helloworld2/


Remove 1.x project and rename 2.0 folder:
rm -rf helloworld;
mv helloworld2 helloworld


Now you can open IntelliJ and then go to file/open project, then find and open helloworld/helloworld.ipr.


There will be some issues such as libraries etc but this a good start. For further tips try these suggestions.


** As of 11th of January 2012 it is not present in Play! 2.0. I fully expect Play! to create an idealize, eclipsify, netbeansify etc as soon as 2.0 is stable.

2 comments:

flurdy said...

For Scala and sbt projects follow this: github.com/mpeltonen/sbt-idea

flurdy said...

And as I predicted, with the release candidate of Play 2.0 there is now again in buildt support for Intellij.

Simply type play idea to create the IntelliJ module. More at github.com/playframework/Play20/wiki/IDE