Unable to resolve play error with Play Framework 2.4.x and IntellijIdea 14.x

I created a Play-java project [v 2.4.2] using an activator [v 1.3.5] that uses JDK 1.8 on a 64-bit Windows OS. I ran the activator run command and it runs smoothly.

But when I open this project in Intellij Idea [v 14.1.4], the IDE does not work properly; warns me in the controller and looks at the files as follows: Intellij IDEA 14.x controller

and this:

Intellij IDEA 14.x view

And he says: "Cannot resolve character ..."

I searched for this and found useful links, included several Q&A elements in the form of stackoverflow, i.e.: Framework tutorial: cannot resolve character index?

I have Scala and Play plugins and on this way ([File → Project Structure → Modules → [MyAppModule] → Sources tab]) there is no "target / scala - [version] / src_managed". Take a look:

Intellij IDEA 14.x project structure

In this version of Intellij Idea or Play, something has changed.

I tried some combinations to create folders as the source folder or as an exception. I used the IDE option: "Invalidate Caches / Restart". None of them worked for me.

How can I fix this problem?

+5
source share
2 answers

Finally, I have a solution. Here are the steps I followed:

  • Create a play-java project using an activator.
  • Import this project as an SBT project in Intellij Idea.
  • Right-click on the project, then select "Add Frame Support" and then select "Play 2.x"
  • Assembly → make a project.

Now everything is working fine.

+6
source

For a game project, you must let Intellij know that this is an SBT project.

File -> Open -> select the .sbt file in the root directory of your project. Intellij will take some time to resolve the project and download dependencies.

In addition, based on my personal experience, you should use the new activator to create a new Play project and import this project into Intellij, and not directly create a Play project using the Intellij Play plugin. Sometimes the plugin does not work correctly.

+4
source

All Articles