IntelliJ IDEA + Play Framework 2.3.7 Issues

732 views
Skip to first unread message

Ben Developer

unread,
Jan 27, 2015, 1:59:58 PM1/27/15
to play-fr...@googlegroups.com
Hi everyone,

I'm having trouble setting up Intellij IDEA v14.0.2 and Play 2.3.7.

I've installed the Scala plugin, SBT plugin, and playframework plugins.

The two issues I'm facing are:

1) The editor highlights anything to do with reverse routing as an error, and shows the error: Cannot resolve symbol "routes"
2) The editor highlights anything to do with Lists or Collections passed in as template params as cannot convert between java.util.List and scala.List.

Any ideas what I could be doing wrong?

Will Sargent

unread,
Jan 27, 2015, 4:50:58 PM1/27/15
to play-fr...@googlegroups.com
Do you have Intellij IDEA Ultimate?


"You still need to run IntelliJ IDEA Ultimate to enable Play 2.0 support though."

Will Sargent
Consultant, Professional Services
Typesafe, the company behind Play Framework, Akka and Scala

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Bryant

unread,
Jan 27, 2015, 4:55:38 PM1/27/15
to play-fr...@googlegroups.com
You're not alone.

One thing that could help the first problem is to locate the target/scala-2.10/src_managed and target/scala-2.10/twirl directories in the project view, then right click and Mark Directory As -> Generated Sources.

(It's possibly they may already be set up so in your project, but they aren't for my sub-projects and the assignment gets forgotten every time I re-open my project.)

I'm afraid I can't help with the Java lists issue in templates.

Ben Developer

unread,
Jan 27, 2015, 5:21:23 PM1/27/15
to play-fr...@googlegroups.com
Will - yes, I'm using Ultimate.
Mike - thanks! that fixes the routes issue, but the lists issue remains. The full message looks something like this: render(scala.collection.immutable.List<models.TestModel>) cannot be applied to (java.util.List<models.TestModel)

Will Sargent

unread,
Jan 27, 2015, 5:26:51 PM1/27/15
to play-fr...@googlegroups.com
Try deleting the .idea and .idea_module directories, and then "Import project" from Intellij IDEA's menu.  It should recognize it's a Play project by itself.

Will Sargent
Consultant, Professional Services
Typesafe, the company behind Play Framework, Akka and Scala

Ben Developer

unread,
Jan 27, 2015, 5:30:31 PM1/27/15
to play-fr...@googlegroups.com
Tried doing that. It does show up as an SBT project, but doesn't show "Play" anywhere. Same results after trying it.

武可

unread,
Jan 27, 2015, 8:54:55 PM1/27/15
to play-fr...@googlegroups.com
Try the menu: File -> Invalidate Cache / Restart

Andreas S.

unread,
Jan 28, 2015, 2:38:19 AM1/28/15
to play-fr...@googlegroups.com
I have the same issues as you.

The solution Mike reported for reverse routing works great.

The second issue you reported always happens when in the templates it expects the Scala API, but in the controller you use the Java API. For example: render(play.api.data.Form<>) cannot be applied to play.data.Form<> 
For now I just accept that nearly all my controllers are red underlined. :/

John O'Malley

unread,
Jan 28, 2015, 11:32:22 AM1/28/15
to play-fr...@googlegroups.com
I personally use IDEA only for its syntax highlighting in SBT projects.  I import/refresh using the SBT integration but don't compile or run.  In my experience SBT does a much better (and faster) job.

If you have OSX or Linux (I think) you can use the built in terminal to run sbt.  I find "~ testQuick" invaluable - much better than anything IDEA provides.

Ben Developer

unread,
Jan 28, 2015, 1:04:37 PM1/28/15
to play-fr...@googlegroups.com
I do the same thing. I only use IDEA for syntax highlighting and code completion, but have "activator run" in an open Terminal window.

It would be great if Play had a way to compile the templates to a Java-based API to prevent these errors in syntax highlighting.

It's also aggravating having to mark twirl and src_managed as Generated Sources every time I open IntelliJ, but I guess that's not a Play issue. 

Carsten D.

unread,
Feb 9, 2015, 10:26:48 AM2/9/15
to play-fr...@googlegroups.com
Just to chime in, I do the same thing as John. Unfortunately the Play integration into IntelliJ Idea is tricky and a bit frustrating (I'm using v. 14 Ultimate with the latest Scala plugin). If things change, or just after a minor Play update, the syntax very often breaks, routes or other references are marked as errors, and I just found myself giving up on this since I can't find the time to delete/reimport/fix SBT projects in Idea every time. So I just use Idea for code completion and refactoring if possible, but syntax marked as error can be confusing. The integration of Play development into Idea feels quite incomplete, unfortunately I don't know the cause of it and if it can be fixed easily.

ßìnòy S

unread,
Feb 11, 2015, 1:04:28 PM2/11/15
to play-fr...@googlegroups.com
I also use it for Code Completion and Debugging using jvm-debug on play command line. I can hardly trust the error highlighting now. My code module has "red" everywhere, using IntelliJ EAP latest

Philip Johnson

unread,
Feb 11, 2015, 1:12:28 PM2/11/15
to play-fr...@googlegroups.com
Just to provide a different perspective, I'm using Play 2.3.7 (Java) with IntelliJ 14 on simple projects and everything works perfectly.

One idea: generate the play-java template using activator new, then import into IntelliJ.  For me, that project loads, compiles etc perfectly. (I can run both tests within IntelliJ as well, although I get a problem loading the project's .js file).

If your environment can load the correctly, then start modifying it until you start getting problems.  Post the resulting code to GitHub as a test case for IntelliJ/Play folks to look at.

Philip
Reply all
Reply to author
Forward
0 new messages