I've created a Play-java [v 2.4.2] project with using activator[v 1.3.5] that uses JDK 1.8 on Windows 64-bit OS. I've run activator run
command and it works smoothly.
But when I open that project in Intellij Idea [v 14.1.4] IDE not working properly; warns me in controller and view files as follows:
and this:
And it says: 'Cannot resolve symbol ...'
I googled this and find some useful links, included a few stackoverflow Q&A's, i.e: Play framework tutorial: Cannot resolve symbol 'index'?
I've Scala and Play plugins and in this path ([File -> Project Structure -> Modules -> [MyAppModule] -> Sources Tab]) there is no "target/scala-[version]/src_managed" directory. Look this:
In this Intellij Idea or Play version, something's changed.
I've tried some combinations for making folders as source folder or excluded. I've used IDE's option: 'Invalidate Caches/Restart'. None of them worked for me.
How can I fix this issue?
Finally I've got the solution. Here are the steps that I followed:
Now everything works fine.
For play project, you have to let Intellij know this is a SBT project.
File -> Open -> select the .sbt file under the root directory of your project. It will take Intellij a while to resolve the project and download dependencies.
In addition, from my personal experience, you should use activator new to create a new Play project and import that project into Intellij rather than directly creating a Play project usingn Intellij Play plugin. Sometimes, the plugin does not work properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With