So, I'm trying out Play 2 with Eclipse. I create a new project, compile it, run eclipsify and import it into Eclipse. So far so good.
The problem I'm having is that when I make a change in the Scala template, my Java controllers can't see it, and Eclipse marks the code as invalid. For example:
I added a second parameter in my index template
@(message: String, nesto:Integer)
When I try to render my file from the controller, the following line displays an error, because Eclipse still thinks that the index.render takes one String.
return ok(index.render("Your new application is ready.",2));
I turned on the workspace refreshing in Eclipse, and play eclipsify automatically added the classes_managed directory to the build path.
I did the following things :
classes_managed
directory generated by play eclipsify
from my build path, and I added it manually using "Add external class folder"And then it worked for me. It seems that there is a bug with the eclipsify
command.
The trick is to have Play building automatically in the background (template files are not currently built by Eclipse, so you need Play to translate those for you). It's all explained in detail here:
[dead link] http://scala-ide.org/docs/tutorials/play20scalaide20/index.html
[try this one] http://scala-ide.org/docs/tutorials/play/index.html#installing-the-scala-ide-play2-plug-in
For Java Play Framework v2.4.6 (activator v1.3.7) with Eclipse Mars:
Instead of @(message: String, nesto:Integer)
, have you tried this @(message: String)(nesto: Integer)
?
So that you will not have a "can not resolve error" with your index.render()
, you can add this <classpathentry kind="lib" path="target/scala-2.11/classes"/>
to your .classpath
or right-click on your project -> Build Path -> Configure Build Path -> Add Class Folder and make it point to target/scala-2.11/classes
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With