corrupt resolve for Play 2 framework support

Hi guys,

I need some help with opening a Play project in IDEA. I've got all the plugins (Scala, Play Support, Play 2.0...) installed and when I open up a new project everything resolves just fine.
However, if I open a project that has been created by Play, create the .idea files with either gen-idea or play idea I get the following error:
          Play2:
           You have useless source roots which may corrupt resolve for play 2 framework in your project:
           /.../target/scala-2.10/src_managed/main
           /.../target

I can still run the project from IDEA (by adding a new run config and removing the make part of it) but the code itself is entirely erroneous.

Any ideas will be much appreciated!!
I've tried using Eclipse for the past few days and though the setup was easier, working with it is awful.

Thanx.

2 comments
Comment actions Permalink

Hello,

Play2 default .idea project creator adds generated stuff (i.e. output of routes compiler and template compiler) to the project source roots, it is usually under ../target/scala-..../src-managed, so template and routes references in project can be resolved to this code. However, Idea uses its own resolve system for templates and routes. So if compilers output is in source roots, there is an ambiguity in resolve as both variants (from output and from idea's resolve system) are considered suitable. In most cases, references in code that cannot be resolved to the only symbol are considered erroneous. That's probably why you see a lot of red code in your project. I suggest deleting these source roots (right click on the folder in the project structure -> Mark Directory As -> Unmark as Source Root).


Best regards,
Dmitry Naydanov

0
Comment actions Permalink

I tried excluding the folders as you suggested but that didn't work.

To make things a bit easier I imported the Hello World application in the Play samples.
I did that by running `play idea with-source=yes` and then opening the project in IDEA (as opposed to importing it).
Then I compiled the project with `play compile`.
To run the project I removed the 'make' part in the run configuration.
The project runs just fine and the site displays as expected. When I change the code I see the changes as expected in the Play console.

However, routes in my routes file are still getting 'cannot resolve' errors.

Should I even expect to have IDEA present compilation errors as Eclipse does? Or will I only see compilation errors in the Play console?

Thanx

0

Please sign in to leave a comment.