How to configure Java Annotation Processor(s) in Eclipse?

白昼怎懂夜的黑 提交于 2019-12-01 17:58:40

I was finally able to enable my own annotation processor by adding my jar file.

  1. Right click on the project and select Properties.
  2. Open Java Compiler -> Annotation Processing. Check "Enable annotation processing".
  3. Open Java Compiler -> Annotation Processing -> Factory Path. Check "Enable project specific settings". Add your JAR file to the list.
  4. Clean and build the project.

And it finally worked.

Avinash Kadam

It is very much straightforward provided that whatever APT plug you are trying use is correctly configured.

Follow the steps mentioned in above post and the reference image to visualize it. Image showing QueryDsl APT configuration for maven project.

While compiling via command prompt or terminal, you can see all the logs in same screen after the compilation command. In eclipse, these logs can be seen at

Window->show view->General->Error Log

If you want the IDE(Eclipse) to point out the warning, error or other diagnostic message exactly at the particular element in the code editor, we have to call the printMessage method of javax.annotation.processing.Messager with 3 arguments as shown below.

messager.printMessage(Kind.ERROR, "Error Message", element);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!