我已经用play 2.3.7创建了一个play项目。
在项目目录中,我运行了activator并运行了eclipse
命令以生成Eclipse项目文件。
当我进入eclipse时(我从Typesafe Build ID:4.0.0-vfinal-20150119-1023-Typesafe使用Scala IDE时,我的Application.scala文件中存在错误:
object index is not a member of package views.html
我的设置有问题吗?当我在激活控制台提示符下执行
run
时,该应用程序运行良好。谢谢!
编辑:添加代码
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."))
}
}
错误在“确定..”行上。
View 中有一个名为index.scala.html的文件,当我从激活程序运行该文件时,该应用程序会运行该文件。
最佳答案
在Play 2.4.x中添加 View 后,有时IntelliJ IDEA有时会感到困惑,并且绝对拒绝构建。甚至重建项目也会失败:
在IDEA 15中,有时仍会发生这种情况。当发生这种情况时,命令行会提供最快,最可靠的修复程序:
sbt clean; sbt compile
而已! IDEA现在将按预期编译该项目。
更新:
在极少数情况下
sbt compile
在命令行上成功完成,但是IntelliJ IDEA 15仍然给出相同的“对象x不是成员”错误,那么这解决了IDEA的困惑:文件菜单:
关于eclipse - 在Scala IDE中打开Scala Play项目时的“object index is not a member of package views.html”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28458597/