intellij“对象索引不是包views.html的成员” [英] intellij "object index is not a member of package views.html"

查看:259
本文介绍了intellij“对象索引不是包views.html的成员”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Intellij 15.0.5但我无法摆脱这个错误

I've got Intellij 15.0.5 and I cannot get rid of this error

object index is not a member of package views.

我在Intellij中创建了一个新的游戏项目,并且还使用了激活命令

I've created a new play project in Intellij and also using the activator command

activator new PlayTestProject

但我一直收到上述错误。我已经在SO上阅读了所有其他类似的问题,但没有一个帮助,我尝试了以下

But I keep getting the above error. I've read all the other similar question on SO but none of them helped and I've tried the following


  1. 右键单击项目 - >添加框架支持 - >选择播放2

结果:我没有看到我的项目有任何变化。当我点击OK时,窗口消失但是如果我第二次尝试相同的话。什么都没发生,窗口仍在那里!

Result: I didn't see any change to my project. When I hit OK, the window disappears but if I try the same the second time. Nothing happens and the window is still there!


  1. 偏好 - >语言&框架 - > Play2 - >选择为此项目使用Play 2编译器

结果:我收到此错误

Error:Module 'client' production: java.lang.NullPointerException

我试过


  • 使缓存无效&重新启动

  • sbt clean

  • 结帐新项目

但是我在Intellij中一直遇到同样的错误。

But I keep getting the same error in Intellij.

在命令行上运行 sbt compile 运行构建成功的。但是Intellij一直向我显示上述错误。

Running sbt compile on command line runs the build successful. But Intellij keeps shows me the above error.

我如何解决这个问题?

推荐答案

好吧,如果有人遇到同样的问题。修复是在Intellij中将以下两个目录标记为 Sources Roots

Alright if anyone is running into the same problem. The fix was to mark the following two directories as Sources Roots in Intellij.


  • / target / twirl / main

  • / target / routes

步骤:


  1. 右键单击目标文件夹 - > 标记目录为 - > 取消排除(如果您没有看到取消排除,请执行下一步。

  2. 右键单击 target / scala-2.11 / twirl / main 文件夹 - > 将目录标记为 - > 来源Root

  3. 右键单击 target / scala-2.11 / routes 文件夹 - > 将目录标记为 - > 来源根

  4. 右键单击项目打开模块设置 - > 来源 - >并删除以上两个目录(如果已添加) 排除文件夹的部分。

  1. Right click the target folder -> Mark directory as -> Cancel exclusion (If you don't see Cancel exclusion do the next step.
  2. Right click the target/scala-2.11/twirl/main folder -> Mark directory as -> Sources Root
  3. Right click the target/scala-2.11/routes folder -> Mark directory as -> Sources Root
  4. Right click the project Open module settings -> Sources -> and remove the above two directories if there are added in the Excluded folder's section.

这解决了我的问题。

这篇关于intellij“对象索引不是包views.html的成员”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆