Removing error in IntelliJ in Play Framework project

My method in my application class is showing an error in IntelliJ which is not an error. The method works fine in my browser, and as you know (if you are familiar with Play), compilation errors will show up in your browser when you run the program. My method works as planned, but the error indication in the IDE will not go away.

If you are using Eclipse (Scala IDE) you just run the command activator eclipse

on the command line and the IDE won't complain anymore - is there a similar fix for IntelliJ?

Edit: I'm using Play 2.4, so the command activator idea

doesn't work either: Play Framework 2.4 and IntelliJ idea

Edit 2: Do not duplicate IntelliJ Ultimate cannot find routes in Play 2.3 (Java) tests because it is about IDE not finding routes and mine is wrong error indication with various solutions to various problems. See the accepted answer for the correct solution.

+3


source to share


1 answer


IDEA 14.1.3 does not correctly set the classpath when importing a Play 2.4 application. By default, the folder is target

excluded from the classpath. However, twirl templates and routes are compiled to the target folder and must be available for the classpath.

To fix the problem

  • Make sure your classes and templates are compiled: Build > Make

  • Open File > Project Structure

  • Go to the menu Modules

    and select the moduleroot

  • Go to the tab Sources

  • Remove the folder target

    from exclusions by clicking on X

    next to it in the right pane
  • Click "Apply"


Then you can see what target\scala-2.11\routes\main

and are target\scala-2.11\twirl\main

correctly recognized as source folders.

Your error should be gone.

+8


source







All Articles