I'm a beginner user of Play Framework 2.1.3 and I have just created a new Java application and I have run play eclipse
to generate the eclipse project for it. I have also tested so that it works by doing a play run
.
So I'm following this tutorial and there is a step where you should add this piece of code:
public static Result index() {
return redirect(routes.Application.tasks());
}
But I'm getting the message "routes cannot be resolved". I have also tried play compile
and in Eclipse doing a clean to no avail.
I was having the same trouble after the recent 2.4.X release of Play and the solution of cleaning/compiling/reimporting wasn't working. The solution for me was to:
The problem is basically that the managed source directory wasn't being created, these lines fix the problem.
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java // Java project. Don't expect Scala IDE
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources) // Use .class files instead of generated .scala files for views and routes
EclipseKeys.preTasks := Seq(compile in Compile) // Compile the project before generating Eclipse files, so that .class files for views and routes are present
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