IntelliJ IDEA reports route errors

  • I created a project activator new play-scala-intro play-scala-intro
  • In IDEA, I clicked FileImport project from Existing sourcesand selected SBT.

enter image description here

This is the default project structure: dfdfdf

I also tried all the tips from here (recommended for Play 2.2 - 2.3, whereas I have Play 2.4). But I did not try to add target/scala-*/classes_managedto the sources, because my project does not contain this folder.

Version

  • I have an Idea 14 Ultimate with Scala plugins installed and "Playframework support".
  • Play Framework: addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.1")
  • scalaVersion := "2.11.6"
+4
source share
3 answers

JetBrains Scala/Play, Play 2.4 (, ). , , .

. https://youtrack.jetbrains.com/issue/SCL-8812. : " EAP IntelliJ Scala 1.6.27.1.EAP, IntelliJ EAP 15 ".

IntelliJ 15. , IntelliJ 14 .

+5

IntelliJ IDEA - 14.1.4, @ controllers :

GET         /                    @controllers.Application.index

IDE Cannot resolve ....

+3

. 2.4 . https://www.playframework.com/documentation/2.4.x/ScalaRouting , -

, - , - . , "" " ", build.sbt, , :

routesGenerator: = InjectedRoutesGenerator

, build.sbt, -

routesGenerator := InjectedRoutesGenerator

, - , .

Therefore, to avoid errors, you will need to add @ to the controllers in the routes file, as indicated here https://www.playframework.com/documentation/2.4.x/ScalaRouting -

The code samples in the Plays documentation assume that you are using a route generator. If you do not use this, you can trivially adapt the code samples for the static route generator either by prefixing the part of the route controller call with the @ symbol, or by declaring each of your controllers as an object, not a class.

0
source

All Articles