Eclipse 3.4.1 - 如何在构建项目时在控制台中查看编译器输出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/585642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse 3.4.1 - how to view compiler output in Console while building a project
提问by Mystic
I have what appears to be a very annoying problem. When compiling a project in Eclipse, I see no Console that shows the invocation of the Java compiler and the build results (as in NetBeans).
我有一个看起来很烦人的问题。在 Eclipse 中编译项目时,我没有看到显示 Java 编译器调用和构建结果的控制台(如在 NetBeans 中)。
If I, for instance, import an existing project into Eclipse and invoke Project->Build Project, is there a view that will show me results of the compilation? While I know that my project contains a number of files that have errors, invoking Build Project shows no visual result/progress of the compilation. It does not show the list of errors so that I can quickly jump to them.
例如,如果我将现有项目导入 Eclipse 并调用 Project->Build Project,是否有视图显示编译结果?虽然我知道我的项目包含许多有错误的文件,但调用 Build Project 没有显示编译的视觉结果/进度。它不显示错误列表,因此我可以快速跳转到它们。
I'm aware that there is a "Problems" view, which shows a list of problems (and not just compiler errors) in all projects and not the particular project that I am working with, which makes it very inconvenient to locate and jump to source of the problem.
我知道有一个“问题”视图,它显示了所有项目中的问题列表(而不仅仅是编译器错误),而不是我正在使用的特定项目,这使得定位和跳转非常不方便问题的根源。
采纳答案by VonC
Since Eclipse JDT provides its own built-in Java compiler, you generally do not see the invocation of Java Compiler.
由于 Eclipse JDT 提供了自己的内置 Java 编译器,因此您通常看不到 Java Compiler 的调用。
The built-in Java compiler is tightly integrated with Eclipse and JDT, and provides the source indexing that enables powerful IDE features such as refactoring and quick fix.
内置的 Java 编译器与 Eclipse 和 JDT 紧密集成,并提供源索引,支持强大的 IDE 功能,例如重构和快速修复。
Plus, it enables incremental build in background after each file modification, hence no visible "java
" invocation.
另外,它在每次文件修改后在后台启用增量构建,因此没有可见的“ java
”调用。
You can replace/complete the java compiler with a javac` call of your own:
您可以使用自己的 javac` 调用替换/完成 java 编译器:
For instance, Using Alcatel-Lucent nmake with Eclipse JDTdoes precisely that, and uses a configuration launcher (which you can instruct to show a console):
例如,将 Alcatel-Lucent nmake 与 Eclipse JDT 一起使用就是这样做的,并且使用了一个配置启动器(您可以指示它显示一个控制台):
You will need to add that special builder in the "builder" section of your project.
您需要在项目的“构建器”部分添加该特殊构建器。
Do not forget you can create many "Problem view", and set one of them to show only problems for your current project.
不要忘记您可以创建许多“问题视图”,并将其中一个设置为仅显示当前项目的问题。
Select: "on any element in same project"
选择:“在同一项目中的任何元素上”
回答by Aaron Digulla
You can configure the problem view to show only problems in the current project:
您可以将问题视图配置为仅显示当前项目中的问题:
- Click on the small triangle at the far right of the view.
- In the popup menu, select "Configure Contents..."
- Select each item in the "Configurations" list and click on "Scope: On any element in the same project"
- 单击视图最右侧的小三角形。
- 在弹出菜单中,选择“配置内容...”
- 选择“配置”列表中的每个项目,然后单击“范围:同一项目中的任何元素”
If you want to see the compiler working, you need open the "Progress" view.
如果你想看到编译器工作,你需要打开“Progress”视图。
回答by Sharique
Goto Windows->Show View->Console or Alt+Shift+Q,C
转到 Windows-> 显示视图-> 控制台或 Alt+Shift+Q,C
Console appears in tab with Problem view
控制台出现在带有问题视图的选项卡中
回答by joel.neely
Your question contains a couple of assumptions that you might want to re-think.
您的问题包含一些您可能需要重新思考的假设。
It does not show the list of errors so that I can quickly jump to them.
它不显示错误列表,因此我可以快速跳转到它们。
Errors are flagged in the edit window while you are editing. You can fix them on the spot, without having to "jump" anywhere.
编辑时会在编辑窗口中标记错误。您可以当场修复它们,而无需“跳”到任何地方。
If you drop an entire source file into your project, you may not be in an edit window on that file. (And, of course, that's not standard Eclipse usage.) The simplest way I know do deal with that is simply to "Refresh" the project and look in the Package Explorer view to see whether there are any errors detected (which will happen immediately if you "refresh" a file into a source folder). Double-click on any files which show an error icon and look at the right-hand side of the edit window to see exactly where the errors are.
如果将整个源文件拖放到项目中,则您可能不在该文件的编辑窗口中。(当然,这不是标准的 Eclipse 用法。)我知道处理这个问题的最简单方法就是“刷新”项目并查看 Package Explorer 视图以查看是否检测到任何错误(这将立即发生)如果您将文件“刷新”到源文件夹中)。双击任何显示错误图标的文件,然后查看编辑窗口的右侧以查看错误的确切位置。
I'm aware that there is a "Problems" view, which shows a list of problems (and not just compiler errors) in all projects and not the particular project that I am working with...
我知道有一个“问题”视图,它显示了所有项目中的问题列表(而不仅仅是编译器错误),而不是我正在使用的特定项目......
Unless you are using multiple projects, with inter-project dependencies, I find it useful to close all but the current project on which I'm working. Then the "Problems" view is specific to the current context.
除非您使用多个项目,并且具有项目间的依赖关系,否则我发现关闭除我正在处理的当前项目之外的所有项目都很有用。然后“问题”视图特定于当前上下文。
Finally, I'd recommend looking at the Mylin "getting started" pagefor other hints on how Eclipse can help you focus on the current task.
最后,我建议您查看Mylin“入门”页面,以获取有关 Eclipse 如何帮助您专注于当前任务的其他提示。