Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors in Eclipse for Scala project generated by Play Framework

Tags:

I would like to use Eclipse as IDE for a Scala web application using Play Framework. I downloaded Eclipse 3.6.2. Then I installed Scala IDE 2.0 (beta) for Eclipse. I downloaded Play Framework 1.2.2RC1 and installed the Scala Module using play install scala-0.9.1 and generated a new site with play new mysite. Then I eclipsified it with play eclipsify mysite and imported the project in Eclipse.

But now I get many errors in Eclipse. Is this anything I can fix or are the different projects incompatible?

This is the generated code that contains errors in Eclipse (but it works when I run the application).

package controllers

import play._
import play.mvc._

object Application extends Controller {

  import views.Application._

    def index = {
        html.index("Your Scala application is ready to go home!")
    } 
}

And this is how it looks like in Eclipse:Scala Play application in Eclipse

like image 390
Jonas Avatar asked May 30 '11 14:05

Jonas


People also ask

How do I run a play framework in Eclipse?

Generate configuration To debug, start your application with sbt -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations. In the Debug Configurations dialog, right-click on Remote Java Application and select New. Change Port to 9999 and click Apply.

Which IDES can be used for play applications?

Play supports the NetBeans, IntelliJ IDEA and Eclipse platforms.

What is Scala IDE?

Scala IDE provides advanced editing and debugging support for the development of pure Scala and mixed Scala-Java applications.


2 Answers

The error shown highlighted in your screenshot is caused by the new Scala template sources not being in the project Build Path. The eclipsify command doesn't currently do this for you.

Manually add tmp/classes to the Build Path to resolve it.

But please note that new Scala template files are not generated from within Eclipse. So if you add a new template/page to your project, you must run 'play run' (or equivalent) first to have the file appear there. Also note that if you run the eclipsify command again in the future you will need to re-add this folder to your Build Path.

like image 85
Ike Avatar answered Sep 20 '22 17:09

Ike


It seems that eclipse thinks that your views package is empty. Did you try to refresh project via F5 command?

like image 26
Nikolay Ivanov Avatar answered Sep 19 '22 17:09

Nikolay Ivanov