Eclipse shows errors in Play 2.4 setup

635 Views Asked by At

I am trying to setup an Scala SDK Eclipse-based IDE to work with Play 2.4 on Windows 8. I followed instructions given on the official guide, but after opening default view index.scala.html, I get a bunch of errors like:

  1. ambiguous reference to overloaded definition,

    both method display in class BaseScalaTemplate of type (o: Any)(implicit m: Manifest[error]) and method display in class BaseScalaTemplate of type (x: error) match argument types (play.twirl.api.HtmlFormat.Appendable) and expected result type Any

    Error occurred in an application involving default arguments.

    index.scala.html /play-scala-test-app/app/views line 3

    Java Problem

  2. type Html is not a member of package play.api.templates

    index.scala.html /play-scala-test-app/app/views line

    Java Problem

I tried to remove default imports and add new import play.twirl.api._ in the Play2 project properties, but that changed nothing. Is there a way to fix the configuration?

2

There are 2 best solutions below

0
François On

see https://groups.google.com/forum/#!topic/scala-ide-user/WFNoQ6GNw1k

1 Fork https://github.com/cweinreben/scala-ide-play2

2 Checkout the project locally

3 Execute ./build.sh in root of the project folder (wait and drink a cup of coffee while it downloads the internet)

4 When finished switch to Eclipse and open the "Install New Software..." Dialog (Menu "Help>Install New Software...")

5 The build script creates a update site - so select "Add" in the dialog and then "Local..." and switch to the folder "scala-ide-play2/org.scala-ide.play2.update-site/target/site"

6 Install the feature in this folder

0
MirMasej On

I don't know about the first issue, but the second one is caused by outdated SbtEclipse plugin. Because of that target/scala-2.11 subfolders are not being added as source paths to the project. To fix this:

  • bump SbtEclipse plugin version to 4.0.0: addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
  • run sbt eclipse from project's root directory
  • refresh the project in Eclipse.