如何为 Java 编译器注释处理设置工作区范围的配置
在项目属性中,我可以转到
Java Compiler >注释处理>工厂路径
并指向我的 jar 文件,一切都很好,但这是我必须为每个项目做的事情(我有很多项目,并且不断添加/删除项目)。该配置路径在工作区级别不可用,我想知道是否有其他方法来设置它。
In project properties I can go to
Java Compiler > Annotation Processing > Factory Path
and point to my jar file and everything is fine, but it's something I have to do for each project (and I have many and am constantly adding/deleting projects). That configuration path isn't available at the workspace level and I'm wondering if there is another way to set it up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能应该使用 Maven(带有 Eclipse m2e 插件),并在每个项目的 POM 文件中或在公共父 POM 文件中配置注释处理。
本页描述了如何配置Maven的Java编译器插件,以及< a href="http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html" rel="nofollow">这个列出了你可以在POM文件中设置的属性。
You probably should be using Maven (with the Eclipse m2e plugin), and configuring the annotation processing in each project's POM files ... or in a common parent POM file.
This page describes how to configure Maven's Java compiler plugin, and this one lists the attributes you can set in the POM file.
据我所知,M2Eclipse 本身并不处理注释处理阶段。
为了弥补这个不足,有 Maven Integration由 JBoss Tools 团队提供的 Eclipse JDT Annotation Processor Toolkit 插件,使用 M2Eclipse 处理注释处理。
GitHub 页面的自述文件部分和 此博文。仔细阅读上述博客文章以了解配置。
As far as I know, M2Eclipse doesn't handle natively the annotation processing phase.
To make up for this lack, there is the Maven Integration for Eclipse JDT Annotation Processor Toolkit plugin provided by JBoss Tools team that handles annotation processing with M2Eclipse.
Explanations of how it works are given in the readme part of the GitHub page and in this blog post. Get a careful reading of the aforedmentioned blog post to understand the configuration.