[英]Play framework: Routing broken
I am having some issues with the Play framework. 我在Play框架方面遇到一些问题。 It won't compile anymore, giving the following error:
它不会再编译,出现以下错误:
java: cannot find symbol
symbol: variable debug
location: class controllers.Application
Indeed this line in Apllication.java is underlined in red in IDEA, but as far as I remember that has always been the case: 确实,Apllication.java中的这一行在IDEA中用红色下划线标出,但据我所知一直是这样:
I do have a debug.scala.html file under views. 我在视图下确实有一个debug.scala.html文件。 If I change the above return statement to
return ok();
如果我将上面的return语句更改为
return ok();
everything compiles fine, but that of course removes all functionality. 一切都可以正常编译,但是当然可以删除所有功能。
PS: The fact that that IDEA thinks that there are errors in the Play code, even when there are none and it all compiles fine, makes debugging somewhat difficult, I find. PS:我发现IDEA认为Play代码中存在错误,即使没有错误并且都可以正确编译,这一事实使调试有些困难。 (As in screenshot above.) Is there a fix for this?
(如上面的屏幕截图所示。)是否有针对此的修复程序?
Idea tries to optimize imports by replacing wildcard imports with dedicated, so you can easily add this import manually: Idea尝试通过用专用替换通配符导入来优化导入,因此您可以轻松地手动添加此导入:
import views.html.debug;
TIP: On the other hand try to DO NOT name your view as debug
, info
etc. - Play's Logger
has such methods so if you will write imports carelessly you can accidentally use it in wrong place, so maybe just better call these views like debugView.scala.html
? 提示:另一方面,请勿将视图命名为
debug
, info
等。-Play的Logger
具有此类方法,因此,如果您不小心编写导入内容,则可能会在错误的地方使用它,因此最好将这些视图debugView.scala.html
?
发现错误:之前,我做了一些重构,并且IDEA决定从文件中删除以下导入,因为它认为该文件未使用:
import views.html.*;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.