简体   繁体   English

通过路由为IntelliJ中导入的Play 2.4.x项目解析控制器

[英]Resolving Controllers via routes for imported Play 2.4.x project in IntelliJ

I'm trying to import any Play project (usually from activator) into IntelliJ and each time I end up with Controllers not being resolved, ie you go to conf/routes and routes.ApplicationController shows up red and inside any Controller completion for routes. 我试图将任何Play项目(通常是从激活器导入)到IntelliJ中 ,每次我最终都无法解决Controller时,即转到conf/routesroutes.ApplicationController显示红色,并且在routes.ApplicationController任何Controller补全内routes. shows no controllers. 没有显示控制器。

The projects do compile in, and even run from IntelliJ , but compiled routes just aren't picked up. 这些项目确实可以在IntelliJ中进行编译,甚至可以从IntelliJ中运行,但是编译后的路由不会被提取。

I don't know if it's related, but on project load I always get the following message: 我不知道是否相关,但是在项目负载下,我总是收到以下消息:

SBT compilation for play framework 2.x disabled by default 默认情况下禁用Play框架2.x的SBT编译

But even if I go into the Languages & Frameworks setup and tell it to use the Play 2 compiler, the routes are not affected. 但是,即使我进入“ 语言和框架”设置并告诉它使用Play 2编译器,路由也不会受到影响。

Hüseyin Zengin is right. 侯赛因·曾金(HüseyinZengin)是对的。 The activator plugin which generates the .idea directory and metadata is no longer 'the way'. 生成.idea目录和元数据的激活程序插件不再是“方式”。

The truth is it doesn't work perfectly out of the box and your best bet is to get on the latest versions of all three. 事实是,开箱即用并不能完美工作,最好的选择是获取这三个版本的最新版本。 This means using the Early Access Program version of Intellij. 这意味着使用Intellij的Early Access Program版本。

This largely depends on the versions of Play!, Intellij and the Scala (formerly Play) plugin. 这在很大程度上取决于Play!,Intellij和Scala(以前称为Play)插件的版本。

If you can't do that or still get the problem anyway then following these steps might help: 如果您无法执行此操作或仍然遇到问题,那么执行以下步骤可能会有所帮助:

Open your Play! 打开您的游戏! 2.x project in Intellij Open Module Settings F4 In the Root Source Settings navigate the directory structure. Intellij打开模块设置F4中的2.x项目在“ 根源设置”中导航目录结构。

Add the main directory at 在以下位置添加目录

target/scala-/routes/main 目标/ scala- /路线/主要

to the Source Folders list. 到“源文件夹”列表。 Right clicking the main folder and selecting Sources is one way to do this. 右键单击主文件夹并选择Sources是执行此操作的一种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM