Eclipse 不显示 TODO 任务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11814737/
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 does not show TODO tasks
提问by vektor
After upgrading to Eclipse Juno and importing an existing Java EE project, the Tasks view does not show TODOs from comments in my .java files. I can manually add new TODO tasks by specifically right-clicking the gutter and selecting Add Task...
from the popup menu, but Eclipse should create TODOs from my comments on its own.
升级到 Eclipse Juno 并导入现有的 Java EE 项目后,Tasks 视图不会显示来自我的 .java 文件中的注释的 TODO。我可以通过专门右键单击装订线并Add Task...
从弹出菜单中选择来手动添加新的 TODO 任务,但 Eclipse 应该根据我的评论自行创建TODO 。
I went through all the preferences related to task tags, they are all default (thus OK), still no tags appear. I tried closing/opening the project, re-building it, I checked Git repo to see that no dot files (.project etc) were modified since everything worked in the older Eclipse.
我浏览了所有与任务标签相关的首选项,它们都是默认的(因此可以),仍然没有出现标签。我尝试关闭/打开项目,重新构建它,我检查了 Git 存储库以查看没有修改点文件(.project 等),因为一切都在旧的 Eclipse 中工作。
Thisquestion did not help me... how to make Eclipse show my Java TODOs?
这个问题对我没有帮助...如何让 Eclipse 显示我的 Java TODO?
采纳答案by vektor
I investigated my .project
file and found the following natures:
我调查了我的.project
文件,发现了以下性质:
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
The first one refers to AspectJ that I use to process some annotations. I realized that the newly installed Eclipse does not contain AspectJ tools by default! After installing AJDT, my TODOs appeared in the Tasks view, thus solving the problem.
第一个是指我用来处理一些注释的 AspectJ。我发现新安装的Eclipse默认不包含AspectJ工具!安装AJDT后,我的TODO出现在Tasks视图中,从而解决了问题。
Weird thing is, why does not Eclipse complain about having a project with an unknown nature (=one there is no plugin for)? And why did this absence of AJDT cause the regular JDT to fail finding the TODOs?..
奇怪的是,为什么 Eclipse 不抱怨有一个未知性质的项目(=一个没有插件)?为什么缺少 AJDT 会导致常规 JDT 无法找到 TODO?...
回答by user2619028
The problem is Eclipse should rebuild the settings (probably a bug). The way to work around this is to start Windows > Preferences > Java > Compiler > Task Tags, then change any tag, then press apply; you will be asked if you allow settings to rebuild, accept. Then change back the altered tag and rebuild again. You should have immediately shown TODO in the Tasks view.
问题是 Eclipse 应该重建设置(可能是一个错误)。解决此问题的方法是启动Windows > Preferences > Java > Compiler > Task Tags,然后更改任何标签,然后按应用;系统会询问您是否允许重建设置,接受。然后将更改后的标签改回并再次重建。您应该立即在 Tasks 视图中显示 TODO。
回答by Sandro
In my case I was just not aware of the fact that the project has to build correctly in order for the TODOs to show up. After I fixed the build errors there was no problem anymore to see the TODOs.
就我而言,我只是不知道项目必须正确构建才能显示 TODO。在我修复了构建错误之后,再看 TODO 就没有问题了。