I have successfully run annotation processor for CLASS level retention annotations via command prompt compiling using Java 8.
However, when I tried to configure the annotation processor in eclipse and tried to run it with "-proc:only"
option, it didn't get effective.
I have included the Jar file containing the custom annotation processor class file into the Project Properties -> Annotation Processing -> Factory Path
. I have also provided the -proc:only
option in Project Properties -> Annotation Processing -> Processor Options
, still the annotation processor isn't getting called when a class containing my annotation is executed.
Please help me identifying the required setting or mistake or additional step for running the annotation processor via eclipse.
The JDT-APT project provides plugins that add Java 5 annotation processing support to Eclipse. A Java annotation processor is a compiler plug-in that can gather information about source code as it is being compiled, generate additional Java types or other resource files, and post warnings and errors.
"Annotation Processing" is a hook into the compile process of the java compiler, to analyse the source code for user defined annotations and handle then (by producing compiler errors, compiler warning, emitting source code, byte code ...). API reference: javax. annotation.
I was finally able to enable my own annotation processor by adding my jar file.
And it finally worked.
It is very much straightforward provided that whatever APT plug in you are trying to 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With