How to best setup a Play / Scala / Intellij project

Hey all. I'm using oracle Play 2.2.1 built with Scala 2.10.2 (running Java 1.7.0_45) on Os X.

I just created a play module in Intellij, right clicked and select Run Tests on the test directory but the results of that is a compile error;

object index is not a member of package views.html

    Ok(views.html.index("Your new application is ready."))
                  ^

I assumed that this was just an error in how intellij handles Play and Scala project, so I created a new play project - ran play idea and opened those files. RIght clicked the test directory and got a different error;

Class not found: "ApplicationSpec"


I doubt that this is the normal out of the box experience. Both projects work if I do play test on the cli,

After having run the tests using play test on the command line, I can run the tests fine from the IDE for the project that I created using the play command. The project that intellij created now gives me the following error;
org.specs2.execute.Error$ThrowableException: VerifyError: Cannot inherit from final class


5 comments
Comment actions Permalink

The reason for the the first error is that Idea is not compiling the view.  You will find that this needs to be done from a play or sbt "compile" command.

Worse, you need to compile the view from a command line whenever you change the view.  I have already raised this in a previous thread, but it has not been acknowledged, I think.

http://devnet.jetbrains.com/thread/451703?tstart=0

Then you see the second VerifyError.

While I whole-heartedly agree with you that this should not be the "out of the box experience" & that what you describe should work, I thought it might help you to know that another approach may work better.

We always create projects using a "play new", then either an "idea" command or an sbt "gen-idea".  Apart from anything else, this helps when it is sometime later necessary to regenerate the project when build.scala is altered.

http://www.playframework.com/documentation/2.2.1/IDE

Even then, I think you have to run the tests once in a play console before you can run  them from Idea

I hope this helps.

0
Comment actions Permalink

It's fixed now, and we reupdated plugin to version 0.30.379.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Thanks Alexander

I am mainly working from the nightly, 0.31.491, but I'll await the fix arriving in the nightly too.  I can see the view rebuild now works in 0.30.378.

I still see:

org.specs2.execute.Error$ThrowableException: VerifyError: Cannot inherit from final class

In 0.30.378 but maybe 379 fixes that.  In any case, that one does not bother me personally.

ATB

0
Comment actions Permalink

0.31.496 contains this fix. It's not uploaded yet.
As for Specs error, please report it to our issue tracker with Specs2 version number and probably source example: http://youtrack.jetbrains.com/issues#newissue=yes

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.