[英]How to view the list of compile errors in IntelliJ?
I am looking for a way to view all compile errors in IntelliJ, similar to how they are displayed in Eclipse.我正在寻找一种在 IntelliJ 中查看所有编译错误的方法,类似于它们在 Eclipse 中的显示方式。 I tried searching here and Google but have not really found a solution.
我尝试在这里和谷歌搜索,但还没有真正找到解决方案。 I really like IntelliJ, I recently converted to it from Eclipse, and I hope this is just something I am missing and not a fundamental deficiency.
我真的很喜欢 IntelliJ,我最近从 Eclipse 转换到它,我希望这只是我缺少的东西,而不是根本的缺陷。
I think this comes closest to what you wish:我认为这最接近您的愿望:
(From IntelliJ IDEA Q&A for Eclipse Users ): (来自IntelliJ IDEA Eclipse 用户问答):
The above can be combined with a recently introduced option in Compiler settings to get a view very similar to that of Eclipse.以上可以与编译器设置中最近引入的选项相结合,以获得与 Eclipse 非常相似的视图。
Things to do:要做的事情:
Switch to 'Problems' view in the Project pane:在“项目”窗格中切换到“问题”视图:
Enable the setting to compile the project automatically :启用设置以自动编译项目:
Finally, look at the Problems view:最后,看一下问题视图:
Here is a comparison of what the same project (with a compilation error) looks like in Intellij IDEA 13.xx and Eclipse Kepler:这是 Intellij IDEA 13.xx 和 Eclipse Kepler 中相同项目(带有编译错误)的比较:
Relevant Links: The maven project shown above : https://github.com/ajorpheus/CompileTimeErrors相关链接:上图的maven项目: https : //github.com/ajorpheus/CompileTimeErrors
FAQ For 'Eclipse Mode' / 'Automatically Compile' a project : http://devnet.jetbrains.com/docs/DOC-1122 “Eclipse 模式”/“自动编译”项目的常见问题解答: http : //devnet.jetbrains.com/docs/DOC-1122
A more up to date answer for anyone else who comes across this:对于遇到此问题的任何其他人的最新答案:
(from https://www.jetbrains.com/help/idea/eclipse.html , § Auto-compilation ; click for screenshots) (来自https://www.jetbrains.com/help/idea/eclipse.html,§ 自动编译;点击截图)
Compile automatically:自动编译:
To enable automatic compilation, navigate to Settings/Preferences |
要启用自动编译,请导航至Settings/Preferences | Build, Execution, Deployment |
构建、执行、部署 | Compiler and select the Build project automatically option
编译并选择自动生成项目选项
Show all errors in one place:在一处显示所有错误:
The Problems tool window appears if the Make project automatically option is enabled in the Compiler settings.
如果在编译器设置中启用了自动生成项目选项,则会出现问题工具窗口。 It shows a list of problems that were detected on project compilation.
它显示了在项目编译时检测到的问题列表。
Use the Eclipse compiler: This is actually bundled in IntelliJ.使用 Eclipse 编译器:这实际上捆绑在 IntelliJ 中。 It gives much more useful error messages, in my opinion, and, according to this blog , it's much faster since it was designed to run in the background of an IDE and uses incremental compilation.
在我看来,它提供了更多有用的错误消息,并且根据此博客,它的速度要快得多,因为它被设计为在 IDE 的后台运行并使用增量编译。
While Eclipse uses its own compiler, IntelliJ IDEA uses the javac compiler bundled with the project JDK.
Eclipse 使用自己的编译器,而 IntelliJ IDEA 使用与项目 JDK 捆绑的 javac 编译器。 If you must use the Eclipse compiler, navigate to Settings/Preferences |
如果您必须使用 Eclipse 编译器,请导航至Settings/Preferences | Build, Execution, Deployment |
构建、执行、部署 | Compiler |
编译器 | Java Compiler and select it... The biggest difference between the Eclipse and javac compilers is that the Eclipse compiler is more tolerant to errors, and sometimes lets you run code that doesn't compile.
Java Compiler并选择它... Eclipse 和javac 编译器之间的最大区别在于Eclipse 编译器对错误的容忍度更高,有时会让您运行无法编译的代码。
On my system (IntelliJ Idea 2017.2.5), it was not sufficient to enable "Make Project Automatically".在我的系统(IntelliJ Idea 2017.2.5)上,启用“自动制作项目”是不够的。 I also had to use the menu item "View, Tool Windows, Problems" to see the problems tool window at the bottom of the screen.
我还必须使用菜单项“查看、工具窗口、问题”来查看屏幕底部的问题工具窗口。
the "problem view" mentioned in previous answers was helpful, but i saw it didn't catch all the errors in project.先前答案中提到的“问题视图”很有帮助,但我发现它没有捕获项目中的所有错误。 After running application, it began populating other classes that had issues but didn't appear at first in that problems view.
运行应用程序后,它开始填充有问题但最初没有出现在该问题视图中的其他类。
I my case I didn't set Source Root
at the src
folder.我的情况是我没有在
src
文件夹中设置Source Root
。 I make a typo to set as Resources Root
.我把一个错字设置为
Resources Root
。 after fix it by right click at src folder > Mark Directory as > Source Root
, the compile error shows.通过
right click at src folder > Mark Directory as > Source Root
修复它后,编译错误显示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.