Search code examples
eclipseplayframeworkscala-ideplayframework-2.4

Play Framework Eclipse Project conversion error


I am a newbie to play framework, just downloaded the Play 2.4.2, created a project using the

activator new

After that, I tried to convert project to eclipse, but the command

 activator eclipse

resulted in the error enter image description here

I have converted it to eclipse project by starting activator ui and through activator web console, converted project to eclipse. But it in the UI also, I have seen the above error message, but it has converted to eclipse project.

Imported the project into eclipse and it is showing error in the Application.java file as shown below. enter image description here

I have downloaded the Scala IDE, tried to import the project, still the same. I have started the application from command line using

activator run

My app is listening on 9000, and refreshed the project in the IDE, still the cannot find symbol is unresolved.

The jump start is not smooth, How to resolve this?


Solution

  • This documentation is worth a read. It explains adding some settings to the build.sbt:

    $ activator new eclipse
    
    Fetching the latest list of templates...
    
    Browse the list of templates: http://typesafe.com/activator/templates
    Choose from these featured templates or enter a template name:
      1) minimal-akka-java-seed
      2) minimal-akka-scala-seed
      3) minimal-java
      4) minimal-scala
      5) play-java
      6) play-scala
    (hit tab to see a list of all templates)
    > 5
    OK, application "eclipse" is being created using the "play-java" template.
    
    To run "eclipse" from the command line, "cd eclipse" then:
    /Users/ben/projects/eclipse/activator run
    
    To run the test for "eclipse" from the command line, "cd eclipse" then:
    /Users/ben/projects/eclipse/activator test
    
    To run the Activator UI for "eclipse" from the command line, "cd eclipse" then:
    /Users/ben/projects/eclipse/activator ui
    
    $ cd eclipse/
    $ echo 'addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")' >> project/plugins.sbt
    $ ./activator compile
    ...
    [info] downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbteclipse/sbteclipse-plugin/scala_2.10/sbt_0.13/4.0.0/jars/sbteclipse-plugin.jar ...
    [info]  [SUCCESSFUL ] com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0!sbteclipse-plugin.jar (2998ms)
    ...
    [info] Compiling 6 Scala sources and 2 Java sources to /Users/ben/projects/eclipse/target/scala-2.11/classes...
    [success] Total time: 36 s, completed 05-Jul-2015 14:00:25
    $ ./activator eclipse
    [info] Loading project definition from /Users/ben/projects/eclipse/project
    [info] Set current project to eclipse (in build file:/Users/ben/projects/eclipse/)
    [info] About to create Eclipse project files for your project(s).
    [info] Successfully created Eclipse project files for project(s):
    [info] eclipse
    $
    

    Then import as an existing project within ScalaIDE (your Eclipse). Then all should be good.