Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intellij "object index is not a member of package views.html"

I've got Intellij 15.0.5 and I cannot get rid of this error

object index is not a member of package views.

I've created a new play project in Intellij and also using the activator command

activator new PlayTestProject

But I keep getting the above error. I've read all the other similar question on SO but none of them helped and I've tried the following

  1. Right click the project -> Add framework support -> select "Play 2"

Result: I didn't see any change to my project. When I hit OK, the window disappears but if I try the same the second time. Nothing happens and the window is still there!

  1. Preferences -> Languages & Frameworks -> Play2 -> select "Use Play 2 compiler for this project"

Result: I get this error

Error:Module 'client' production: java.lang.NullPointerException

I've tried

  • invalidate cache & restart
  • sbt clean
  • checkout a fresh new project

But I keep getting the same error in Intellij.

Running sbt compile on command line runs the build successful. But Intellij keeps shows me the above error.

How do I fix this ?

like image 544
user794783 Avatar asked Apr 06 '16 09:04

user794783


1 Answers

Alright if anyone is running into the same problem. The fix was to mark the following two directories as Sources Roots in Intellij.

  • /target/twirl/main
  • /target/routes

Steps:

  1. Right click the target folder -> Mark directory as -> Cancel exclusion (If you don't see Cancel exclusion do the next step.
  2. Right click the target/scala-2.11/twirl/main folder -> Mark directory as -> Sources Root
  3. Right click the target/scala-2.11/routes folder -> Mark directory as -> Sources Root
  4. Right click the project Open module settings -> Sources -> and remove the above two directories if there are added in the Excluded folder's section.

This fixed my problem.

like image 108
user794783 Avatar answered Sep 21 '22 16:09

user794783