Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
646 views
in Technique[技术] by (71.8m points)

eclipse - "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..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...