Intellij IDEA无法使用Play框架解析符号 [英] Intellij IDEA can not resolve symbol with Play framework

查看:245
本文介绍了Intellij IDEA无法使用Play框架解析符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IDEA 13和Play 2.2.1,并在播放中进行示例网站

I am using IDEA 13 with Play 2.2.1 and was doing the examples on the play site.

public static Result index() {
   return redirect(routes.Application.tasks());
}

IDEA表示无法解析方法重定向(?),红色表示路线。 Application.tasks()

IDEA says "cannot resolve method redirect(?)" and red underlines routes.Application.tasks()

我已从播放控制台完成编译然后创意。

I have done "compile" and then "idea" from the play console.

推荐答案

测试我的控制器时遇到了类似的问题。我通过文件>解决了这个问题。 打开项目并选择Play框架项目的基本文件夹(之前从文件夹中删除所有构思设置文件,以便它将使用SBT设置重新导入)。

I had a similar problem when testing my controller. I solved it by "File" > "Open Project" and choose the base folder of the Play framework project (delete all idea settings file from the folder before so that it will reimport using the SBT settings).

对IDEA的SBT支持的最后一个版本完成了90%的工作。然后F4进入模块设置对话框。设置您的项目依赖项,如下图所示(明亮的红色文件夹已由IDEA设置,但在我的项目中尚不存在,所以不要担心,如果它们在您的项目中)。这是一个在思想将使用和索引的代码中包含托管类和生成代码的问题。

The last version of the SBT support for IDEA did 90% of the work. Then F4 to enter module settings dialog. Set up your project dependencies like in the picture below (the bright red folder have been set by IDEA and do not exist yet in my project so do not worry if they do in yours). It is a matter of including managed classes and generated code in the code that idea will use and index.

现在我可以在IDEA中使用这样的代码并调试它没问题。

now I can use code like this from within IDEA and debug it no problem.

Result result = Helpers.callAction(controllers.routes.ref.CrudController.createEntity(CrudEntities.contact.name()),
        new FakeRequest().withJsonBody(paramJson)
);

你的做法也应该有效。

这篇关于Intellij IDEA无法使用Play框架解析符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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