I am using IDEA 13 with Play 2.2.1 and was doing the examples on the play site.
public static Result index() {
return redirect(routes.Application.tasks());
}
IDEA says "cannot resolve method redirect(?)" and red underlines routes.Application.tasks()
I have done "compile" and then "idea" from the play console.
I had to add the below plugin entry to my plugins.sbt (under projects folder) for intellij IDEA to resolve play variables like routes etc.
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
Note: After adding the above plugin to plugins.sbt, run the below commands to rebuild idea and resolve the issue:
These steps work for me: add following lines to your plugins.sbt file:
Run this command -
I had a similar problem - IDEA could not resolve Play! framework dependencies.
In my case there was a problem with .idea folder. I copied project to separate folder and run "activator idea" command in the copied project root folder. Then I compared .idea folders in original project and copied project - there I found a difference! In copied project in folder .idea/libraries there were lots of XML files containing links to dependencies, so I copied them to the same folder to original project, re-indexed project and everything works perfect from that moment :) I did it like this because I didnt want to loose my project settings (deleting .idea folder and run command "activator idea" in original project folder should resolve the problem, but settings for project would be lost).
Hope this helps somehow :).
I had a similar problem when testing my controller. I solved it by
"File" > "Open Project"
and choose the base folder of the Play framework project (delete all idea settings file from the folder before so that it will reimport using the SBT settings).The last version of the SBT support for IDEA did 90% of the work. Then F4 to enter module settings dialog. Set up your project dependencies like in the picture below (the bright red folder have been set by IDEA and do not exist yet in my project so do not worry if they do in yours). It is a matter of including managed classes and generated code in the code that idea will use and index.
now I can use code like this from within IDEA and debug it no problem.
your way of doing it should work as well.
I could solve the problem by marking the generated code directories as the "Sources" folder. Go to File -> Project Structure -> "root" module -> Sources.
In my case running the sbt command from a user that doesn't have permission for the project you're entering sbt in. Clean up and then change folder permissions with chown -R yourUser /path/to/project and it should fix it. After that
./sbt compile