“对象索引不是包view.html”的成员“当在scala ide中打开scala播放项目时 [英] "object index is not a member of package views.html" when opening scala play project in scala ide
问题描述
我创建了一个播放项目,播放2.3.7
在项目目录中,我运行激活器并运行 eclipse
命令生成eclipse项目文件。
当我去eclipse(我正在使用Scala IDE from typesafe Build id:4.0.0-vfinal -20150119-1023-Typesafe,我的Application.scala文件有一个错误:
对象索引不是包的成员views.html
我的设置有什么不好吗?当我执行在激活控制台提示下运行
。
谢谢!
:添加代码
包控制器
import play.api._
import play。 api.mvc._
对象应用程序扩展Controller {
def index = Action {
Ok(views.html.index(your new application ready ))
}
}
错误在好吧..
视图中有一个名为index.scala.html的文件,当我从激活器运行时,应用程序运行文件。
$ b $在Play 2.4.x中添加视图后,有时候,IntelliJ IDEA有时会感到困惑,绝对拒绝建立。甚至重建项目失败:
这仍然发生在时间在IDEA 15中。如果这样,命令行提供了最快,最可靠的修复:
sbt clean ; sbt compile
就是这样! IDEA现在将按预期编译项目。
更新:
在极少数情况下, sbt compile
在命令行上成功完成,但IntelliJ IDEA 15仍然给出相同的对象x不是成员错误,那么这解决了IDEA的困惑:
文件菜单:
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..
Occasionally after adding a view in Play 2.4.x, IntelliJ IDEA sometimes gets confused and absolutely refuses to build. Even rebuild Project fails:
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:
这篇关于“对象索引不是包view.html”的成员“当在scala ide中打开scala播放项目时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!