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.
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.
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.
Result result = Helpers.callAction(controllers.routes.ref.CrudController.createEntity(CrudEntities.contact.name()), new FakeRequest().withJsonBody(paramJson) );
your way of doing it should work as well.
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