Search code examples
javaeclipseplayframeworktypesafe-activator

Play Framework with Eclipse enable suggestions and remove errors


I've recently started learning Play framework and I've been playing around with some of the templates.

I've created an eclipse project using "activator eclipse" and imported it into my IDE but what I'm wondering is there a way within eclipse to enable suggestions on Play framework libraries/syntax so that when I type something and press CTRL + Space I get a suggestion/auto fill.

Also the app runs fine but looks like there is errors in my java class:

enter image description here

Thanks for the help.


Solution

  • Make sure you use the latest version of sbt-eclipse (in your project/plugins.sbt), which is 5.1.0: https://github.com/typesafehub/sbteclipse/releases

    5.1.0 did fix the problem with the index not being found.

    Now remove the project from eclipse, run activator eclipse again, and the re-add the project to eclipse. Like described in the documentation, make sure you have

    EclipseKeys.preTasks := Seq(compile in Compile, compile in Test)
    EclipseKeys.projectFlavor := EclipseProjectFlavor.Java
    EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources)
    

    set in your build.sbt.

    Tip: Also add

    EclipseKeys.withSource := true
    EclipseKeys.withJavadoc := true
    

    to build.sbt so also the source of all the libraries are fetched (if available) and also the libraries javadocs are added.