Play Framework Tutorial: Cannot resolve symbolic "routes"

I'm following the game tutorial and I got stuck in about 9 minutes. The route file will not be resolved. I did the same as shown in the tutorial, but still does not work.

package controllers; import models.Bar; import play.core.Router; import play.data.Form; import play.mvc; import play.*; import play.Routes; import views.html.indes; public class Application extends Controller { public static Result index() { return ok(index.render("Hello")); } public static Result addBar(){ Bar bar = Form.form(Bar.class).bindFromRequest().get(); bar.save(); return redirect(routes) } } 
+7
intellij-idea
source share
4 answers
 Project Structure -> Modules -> Dependencies -> + -> JAR or directories -> target/scala-#.##/classes_managed 

Marking this directory as a source Root / Generated Sources Root did not work for me, as mentioned in some other S / O posts

+6
source share

It was localhost: 9000. I will try to start the server again. In fact, the code cannot identify the routes file that is under conf. I'm just trying to reproduce everything that is shown in the textbook, but this does not happen!

+2
source share

These steps work for me:

  • Add the following lines to the plugins.sbt file: addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0") in the project folder.
  • Delete the .idea folder from your project.
  • Run the command from cmd sbt gen-idea
  • import the project again in intelliJ
0
source share

Based on the information you provide, you need to use the following URL:

 localhost:9000 

not localhost: / 9000. The above URL should call the index method (inside the application controller). Based on the implementation you shared, this will cause the index template to be used to render the view (with a 200 HTTP response). Make sure you have index.scala.template in the views directory.

-one
source share

All Articles