eclipse - 在Scala IDE中打开Scala Play项目时的“object index is not a member of package views.html”

标签 eclipse scala playframework-2.0

我已经用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有时会感到困惑,并且绝对拒绝构建。甚至重建项目也会失败:

enter image description here

在IDEA 15中,有时仍会发生这种情况。当发生这种情况时,命令行会提供最快,最可靠的修复程序:

sbt clean; sbt compile



而已! IDEA现在将按预期编译该项目。

更新:

在极少数情况下sbt compile在命令行上成功完成,但是IntelliJ IDEA 15仍然给出相同的“对象x不是成员”错误,那么这解决了IDEA的困惑:

文件菜单:

enter image description here

关于eclipse - 在Scala IDE中打开Scala Play项目时的“object index is not a member of package views.html”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28458597/

相关文章:

java - 使用 eclipse 在 java 中使用 windows 应用程序

json - 在 Spray 1.2.0 路由中将查询字符串参数与 JSON 实体相结合

scala - 宏扩展内的隐式搜索失败

java - Play Framework 中的全局变量/跟踪打开的流

javascript - gwt编译器找不到入口点类

java - 如何在 Windows 8 上继续安装 Roo?

Eclipse-RCP:如何将具有应用程序模型的插件添加到新 RCP 应用程序的透视图中?

scala - #slack RTM api 在 scala 中出现 "{}"消息后断开连接

scala - Play Framework 中的对列表

java - Play框架打包源文件