0
votes

Problem Description:

In A Play framework 2.3.7 project that works just fine in sbt, I consistently get errors in the eclipse editor when editing controllers, for every call to a template. Not just the templates are not recognized where called upon in the controllers, also, likewise, includes for templates inside templates do not work. Probably these "sub templates" called from my templates are the crux of it.

None of the solutions in Play! framework - views aren't compiled? and similar questions help. Ran sbt ~run, invoked the app from browser to force full play compilation, and finally sbt eclipse, prior to importing the project to eclipse, and not forgetting to upgrade to latest version of the eclipse play plugin, and upgrading to sbt 13.6 to match it.

As said, this is all well and fine for sbt to run the project in full, but not for latest version ScalaIDE.

In eclipse, project -> clean and rebuild doesn't solve it either.

Manual workaround that sucks:

It seems that to remove these errors about templates and imports of templates inside templates, I need to manually open all templates imported into other templates, and then reopen the templates that use them as their "sub-templates". Then, if I reopen eclipse, I need to go through this manual procedure again, as it doesn't persist.

Question:

How can I make ScalaIDE (latest version from the official website - 4.0.0), just recognize all templates and the templates they include, without requiring me to open them one by one in its editor?

What should be the correct way to reuse templates inside other templates, such that it works okay also for the ScalaIDE editor? I have already seen that ScalaIDE is less permissive than sbt in similar things...

1

1 Answers

0
votes

This is the workaround adapted from the google group:

  1. Right click the project
  2. "Build path"
  3. "Configure build path..."
  4. Tab "Source" "Add folder"
  5. Expand target --> scala-2.11 --> twirl --> main and tick
  6. "main" Voila

It is mentioned on the google group, a fix avoiding the need for this intervention, is already merged into the forthcoming Play 2.4.0. I think it means it would be enough to have run sbt eclipse as of Play 2.4.0. Hopefully the workaround does not have to be removed from my now worked-around project, if later upgrading Play...