Scala IDE 4.0.0 认为开箱即用的 Play Framework 2.3.7 程序存在错误 [英] Scala IDE 4.0.0 thinks there's errors in an out-of-the-box Play Framework 2.3.7 program

查看:39
本文介绍了Scala IDE 4.0.0 认为开箱即用的 Play Framework 2.3.7 程序存在错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过 Typesafe Activator 创建了一个 Play Framework 程序(因此它完全遵循模板).

I've created a Play Framework program via Typesafe Activator (so it follows the template exactly).

我使用 sbteclipse-plugin 版本 3.0.0 创建一个 Eclipse 项目并将其导入到 Scala IDE 4.0.0.这些都是撰写本文时的最新版本.

I used sbteclipse-plugin version 3.0.0 to create an Eclipse project and imported that into Scala IDE 4.0.0. These are all the latest versions at the time of writing.

Scala IDE 似乎肯定支持 Play 框架.它具有自定义格式的语法突出显示,包括路由文件和模板.然而,它似乎无法从控制器中找到视图.特别是,对 views.html.index 的调用会触发一个错误:对象索引不是包 views.html 的成员".

The Scala IDE definitely seems to support the Play Framework. It has syntax highlighting for the custom formats, including the routing file and templates. Yet, it doesn't seem to be able to find the views from the controllers. In particular, the call to views.html.index triggers an error: "object index is not a member of package views.html".

我尝试使用本机钩子或池启用刷新,如此处详述,但没有任何影响.

I tried enabling refreshing using native hooks or pooling as detailed here, but it had no affect.

我应该注意,虽然代码已经在命令行中编译(使用 activator ~run),但它没有在 Scala IDE 中编译,因为我不知道如何(它似乎没有在任何地方记录).

I should note that while the code has been compiled in the command line (with activator ~run), it hasn't been compiled in Scala IDE, since I don't know how to (it doesn't seem to be documented anywhere).

我该怎么做才能消除这些错误的错误?

What can I do to get rid of these false errors?

运行 activator clean ~run 后,我有另一个错误:在解决构建路径错误之前无法构建项目.没有关于这些构建路径错误是什么的更多细节.

After running activator clean ~run, I have another error: The project cannot be built until build path errors are resolved. There's no further details on what these build path errors are.

推荐答案

更新: 只需升级到 sbteclipse 版本 5.1.0 和一切应该开箱即用.还要确保您遵循 有关如何设置 Eclipse/ScalaIDE 的 Play 文档.

Update: Just upgrade to sbteclipse version 5.1.0 and everything should work out of the box. Also make sure you follow the Play documentation on how to set up Eclipse/ScalaIDE.

这是sbteclipse中的一个已知错误,这可能很快就会修复.

现在,您可以在 build.sbt 中添加以下行:

For now, you can add the following line to your build.sbt:

EclipseKeys.createSrc := EclipseCreateSrc.All

杀死 SBT 控制台并再次运行 sbt eclipse.这应该将以下行添加到项目文件夹中的 .classpath 文件中作为解决方法:

Kill the SBT console and run sbt eclipse again. That should add the following line to the .classpath file within your project folder as a workaround:

<classpathentry kind="src" path="target/scala-2.11/twirl/main"/>

刷新您的 Eclipse 项目以获取更改.

Refresh your Eclipse project to pick up the change.

这篇关于Scala IDE 4.0.0 认为开箱即用的 Play Framework 2.3.7 程序存在错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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