Play Framework 生成的 Scala 项目的 Eclipse 中的错误 [英] Errors in Eclipse for Scala project generated by Play Framework

查看:22
本文介绍了Play Framework 生成的 Scala 项目的 Eclipse 中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Eclipse 作为使用 Play Framework 的 Scala Web 应用程序的 IDE.我下载了 Eclipse 3.6.2.然后我为 Eclipse 安装了 Scala IDE 2.0(测试版).我下载了 Play Framework 1.2.2RC1 并安装了 Scala Module 使用 play install scala-0.9.1 并用 play new mysite 生成了一个新站点.然后我用 play eclipsify mysite 对其进行 eclipsify 并在 Eclipse 中导入该项目.

I would like to use Eclipse as IDE for a Scala web application using Play Framework. I downloaded Eclipse 3.6.2. Then I installed Scala IDE 2.0 (beta) for Eclipse. I downloaded Play Framework 1.2.2RC1 and installed the Scala Module using play install scala-0.9.1 and generated a new site with play new mysite. Then I eclipsified it with play eclipsify mysite and imported the project in Eclipse.

但是现在我在 Eclipse 中遇到很多错误.这是我可以解决的问题还是不同的项目不兼容?

But now I get many errors in Eclipse. Is this anything I can fix or are the different projects incompatible?

这是在 Eclipse 中包含错误的生成代码(但它在我运行应用程序时有效).

This is the generated code that contains errors in Eclipse (but it works when I run the application).

package controllers

import play._
import play.mvc._

object Application extends Controller {

  import views.Application._

    def index = {
        html.index("Your Scala application is ready to go home!")
    } 
}

这就是它在 Eclipse 中的样子:

And this is how it looks like in Eclipse:

推荐答案

屏幕截图中突出显示的错误是由新的 Scala 模板源不在项目构建路径中引起的.eclipsify 命令目前无法为您执行此操作.

The error shown highlighted in your screenshot is caused by the new Scala template sources not being in the project Build Path. The eclipsify command doesn't currently do this for you.

手动将 tmp/classes 添加到 Build Path 中以解决它.

Manually add tmp/classes to the Build Path to resolve it.

但请注意,新的 Scala 模板文件不是从 Eclipse 中生成的.因此,如果您向项目添加新模板/页面,则必须首先运行播放运行"(或等效)以使文件出现在那里.另请注意,如果您以后再次运行 eclipsify 命令,您将需要将此文件夹重新添加到您的构建路径中.

But please note that new Scala template files are not generated from within Eclipse. So if you add a new template/page to your project, you must run 'play run' (or equivalent) first to have the file appear there. Also note that if you run the eclipsify command again in the future you will need to re-add this folder to your Build Path.

这篇关于Play Framework 生成的 Scala 项目的 Eclipse 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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