Playframework - Eclipse cannot detect new template

Possible duplicate:
How to make Eclipse see changes in Play! compiled templates?

I'm taking my first steps with Play! Framework and I am facing some problems. I can create and eclipse a project without problems.

Now, if I add a new view, for example, "sometest.scala.html", and I try to use it in the "application", Eclipse marks this file as an error.

package controllers; import play.*; import play.mvc.*; import views.html.*;; public class Application extends Controller { public static Result index() { return ok(sometest.render("test")); // this line is marked red } } 

Eclipse notes sometest red even if it works. If I go to localhost: 9000, I can see my changes.

My browse folder is as follows:

 app --views ----index.scala.html ----main.scala.html ----sometest.scala.html 

I created sometest as an html file and set the name of the .scala.html file

A simple solution:

launch the application using

 $ cd myapp $ play $ run 

go to your webrwoser and type: localhost: 9000

create a new .scala.html file in your views folder.

Update your site on localhost: 9000

Done.

+3
source share
2 answers

After creating a new view, you first need to run the application in a browser so that Play can compile it as a Scala class (which is recognized by the IDE), then you need to click the menu โ†’ Project Build all, then Eclipse will update the view.

If you wish, you can try IntelliJ, which does not require any additional actions, to start recognizing the classes you just created.

+5
source

I run this problem daily when using eclipse, BUT with eclipse it works pretty well already. Run the game with the play ~ run command, and after that you sometimes only need to select your project in eclipse - right-click and update, run = no errors.

+7
source

All Articles