IntelliJ Ultimate can't find routes in Play 2.

2019-02-19 04:53发布

While my tests run just fine, IntelliJ complains that it can't find the routes object and code auto complete fails to work. I've looked all over the documentation and this should just work. Here is what IntelliJ is reporting

error from intellij

Any thoughts as to what might be wrong with my project configuration?

2条回答
ら.Afraid
2楼-- · 2019-02-19 05:12

Actually your question motivated me to find solution for this annoying issue :)

And actually it was already answered, see this answer which works: https://stackoverflow.com/a/21879374/1066240

Also read other answers and comments.

查看更多
Fickle 薄情
3楼-- · 2019-02-19 05:14

Most likely it's connected with the fact that the routes object is generated during project compilation. After compilation, it should be placed under the target/scala-{ver}/src_managed directory. Mark this directory as source and IntelliJ should see routes correctly.

You can use one of the following steps to do it:

  • right-click the directory in the Project view and select Mark Directory As -> Generated Sources Root

or

  • open File -> Project Structure... -> Modules -> Sources and mark the src_managed directory as Sources using the button above the project structure
查看更多
登录 后发表回答