Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala IDE 4.0.0 thinks there's errors in an out-of-the-box Play Framework 2.3.7 program

I've created a Play Framework program via Typesafe Activator (so it follows the template exactly).

I used sbteclipse-plugin version 3.0.0 to create an Eclipse project and imported that into Scala IDE 4.0.0. These are all the latest versions at the time of writing.

The Scala IDE definitely seems to support the Play Framework. It has syntax highlighting for the custom formats, including the routing file and templates. Yet, it doesn't seem to be able to find the views from the controllers. In particular, the call to views.html.index triggers an error: "object index is not a member of package views.html".

enter image description here

I tried enabling refreshing using native hooks or pooling as detailed here, but it had no affect.

I should note that while the code has been compiled in the command line (with activator ~run), it hasn't been compiled in Scala IDE, since I don't know how to (it doesn't seem to be documented anywhere).

What can I do to get rid of these false errors?

EDIT: After running activator clean ~run, I have another error: The project cannot be built until build path errors are resolved. There's no further details on what these build path errors are.

like image 909
Kat Avatar asked Jan 23 '15 07:01

Kat


1 Answers

Update: Just upgrade to sbteclipse version 5.1.0 and everything should work out of the box. Also make sure you follow the Play documentation on how to set up Eclipse/ScalaIDE.


This is a known bug in sbteclipse, which probably will be fixed soon.

For now, you can add the following line to your build.sbt:

EclipseKeys.createSrc := EclipseCreateSrc.All

Kill the SBT console and run sbt eclipse again. That should add the following line to the .classpath file within your project folder as a workaround:

<classpathentry kind="src" path="target/scala-2.11/twirl/main"/>

Refresh your Eclipse project to pick up the change.

like image 97
mkurz Avatar answered Oct 22 '22 08:10

mkurz