Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Idea + Play Framework - cannot resolve method/symbol

I use IntelliJ IDEA 12, Play 2.2.0, I have Scala plugin installed, Play 2.0 support plugin installed.

I created java play application via termina (play new). Andas you can see in this pictures I always get this error: "cannot resolve method ok()" or "cannot resolve symbol at"

http://sluchatka.kvalitne.cz/pics/1.png

http://sluchatka.kvalitne.cz/pics/2.png

I searched the web for this problem the whole day, but I didn't find solution. Can you please help me?

like image 226
Filip Bouška Avatar asked Nov 04 '13 20:11

Filip Bouška


People also ask

How do I add play framework to IntelliJ?

Create an sbt project with Play 2 framework IntelliJ IDEA creates an sbt project. Open the build. sbt file in the editor and add Play as a project dependency. In the Project tool window, in the project source root directory, select New | File to create the plugins.


2 Answers

The first problem (unable to resolve reference to template) is because your template probably has not been compiled by the moment (and thus IDEA does not see compiled template and can't resolve reference to it).

I usually develop Play apps having ~run command launched in Play console. So that any changes to templates are immediately compiled and changes detected by IDEA.

As for the second one it seems like a deficiency in Play IDEA plugin. It does not work seamlessly within templates I should say. Lots of glitches. The best way I found is to have ~run launched so that small problems are detected immediately.

like image 171
kompot Avatar answered Sep 26 '22 06:09

kompot


According to intelliJ support it is better to import the command line created play 2 project using the IDE import project wizard instead.

  1. File -> Import Project
  2. Select play2 project location
  3. Import as SBT project

This was due to the "play idea" command being outdated or not fully compatible with the current play 2 and scala plugins for intelliJ.

A bonus is that errors start to appear properly, we had trouble with that earlier.

like image 24
Andreas Avatar answered Sep 25 '22 06:09

Andreas