Intellij IDEA does not recognize Play 2.0 features

I checked the project from Github, then ran sbt gen-idea and opened this project in IDEA. One of the project modules uses the Play 2.0 Framework.

But IDEA does not recognize characters specific to Play !. That is, I get the following error: cannot resolve symbol index in the following views.html.index expression.

The same mistakes for others as for Play! Framework features, for example, I get the same error in the routes variable.

PS I installed the plugins Play 2.0 , Scala , SBT , and also configured the root directory of the root of Play 2.0 (in Project Settings - Play configuration )

+4
source share
2 answers

Personally, I do not use the Play addon from IntelliJ. It is always much faster and more reliable to use the command line to compile / generate various elements, including the famous *.template.scala , at the beginning of your notification cannot resolve symbol index .

All you have to do is run this command line based on the application root folder: play , then compile . Of course, do not do this Rebuild project from IntelliJ, otherwise you would remove the generated class files from the command line. When you work with non-managed resources (e.g. templates), just create cmd+F9 to compile.

After making sure that you are compiling from IntelliJ, it is configured to display the same folder as your target folder (as sbt gen-idea (although I use play , then idea with-sources=yes ), it is usually automatically configured).

Then your IntelliJ project will no longer complain about some unresolved views.html.index .

Of course, if you really want to use your IntelliJ IDE, make sure you install the latest Play 2.X plugin .

Alternatively, create a custom run command in IntelliJ to take into account SBT compilation.

+1
source

For those using Java Play 2.4.x and IntelliJ 15, my colleagues at work also encountered this problem. We had the Scala plugin installed (which comes with built-in SBT), and all of our dependencies were wonderful. It turns out that the problem arose because they opened the project (do not ask me why).

Do File → Create → Project from existing sources ...

Do not execute: File -> Open

+1
source

Source: https://habr.com/ru/post/1480442/


All Articles