Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

corrupt resolve for Play 2 framework support in IntelliJ IDEA

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

If I'm reading this correctly, it basically means that IDEA is treating the compiled Play classes as 'useless'. 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 full of 'Cannot resolve' errors.

like image 697
user2663335 Avatar asked Aug 08 '13 06:08

user2663335


1 Answers

Ignore the message, go into Project Structure, select the modules on the left, your module, and on the right-hand side of the screen you should see a tree.

The following should be listed as source: /app, /conf, target/scala-2.10/src-managed

The following should be excluded: (everything in target except src-managed), maybe /.idea and .idea_modules

Note that src-managed will not be there unless you compiled the application before running 'gen-idea' with sbt or idea with play. Personally, I prefer to use (from the command line):

% sbt "gen-idea no-sbt-build-module"

over play idea because gen-idea gives me sources as well in IDEA

Note that if you run the server while in interactive-mode from the command-line, then Play! will compile everything instantly as you refresh the browser and you change the code, so you will develop more rapidly if you do NOT have IDEA compile the project.

This video shows a live-coding with play, showing this http://www.youtube.com/watch?v=8z3h4Uv9YbE

UPDATE

With Play 2.2.x, I have gone back to using idea with-sources=yes no-sbt-build-module because it does include sources correctly.

like image 156
Alex Avatar answered Sep 21 '22 12:09

Alex