Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"object index is not a member of package views.html" when opening scala play project in scala ide

I've created a play project with play 2.3.7

In the project directory, I ran activator and ran the eclipse command to generate eclipse project files.

When I go to eclipse (I'm using the Scala IDE from typesafe Build id: 4.0.0-vfinal-20150119-1023-Typesafe , there is an error in my Application.scala file:

object index is not a member of package views.html 

Is there something amiss with my setup? The app runs fine when I execute run at the activation console prompt.

Thanks!

EDIT: Added code

package controllers  import play.api._ import play.api.mvc._  object Application extends Controller {    def index = Action {     Ok(views.html.index("Your new application is ready."))   }  }  

The error is on the 'Ok..' line.

There is a file in views called index.scala.html, and the app runs file when I run it from activator..

like image 234
user384842 Avatar asked Feb 11 '15 15:02

user384842


1 Answers

Occasionally after adding a view in Play 2.4.x, IntelliJ IDEA sometimes gets confused and absolutely refuses to build. Even rebuild Project fails:

enter image description here

This still happens from time-to-time in IDEA 15. And when it does, the command line provides the quickest, most-reliable fix:

sbt clean; sbt compile

That's it! IDEA will now compile the project as expected.

Update:

In the rare case that sbt compile completed successfully on the command line, but IntelliJ IDEA 15 still gives the same "object x is not a member" error, then this has solved IDEA's confusion:

File Menu:

enter image description here

like image 187
Brent Faust Avatar answered Sep 22 '22 22:09

Brent Faust