I made a note when I tried to make my own annotation process and make it work in Eclipse.
Java
openjdk 10.0.2
Eclipse
Photon (4.8.0)
※Pleiades All in One
OS
Windows 10
See Pluggable Annotation Processing API Usage Memo-Qiita for an explanation of the annotation processing itself and how to run it in Eclipse.
I get the error "The annotation processor factory ... could not be loaded" in the project that set the annotation process. I was at a loss because I didn't know what was going on because I didn't have detailed information.
--The version of the JVM running Eclipse is older than the code that wrote the annotation process. ――After trying various things, the annotation process got stuck even in the old version of Eclipse. --In that Eclipse, a detailed error message was displayed and the error "Unsupported major.minor version xxx" occurred. --Since the Java version used in the project was the same, I noticed that the program running the annotation processing = Eclipse's JVM version seems to be the cause.
--Launch the command line on the machine running Eclipse and run jcmd
> jcmd
6184 sun.tools.jcmd.JCmd
18860
--Eclipse Java process that only outputs the process ID
--Output VM.version
with this process ID as an argument
> jcmd 18860 VM.version
18860:
Java HotSpot(TM) 64-Bit Server VM version 25.162-b12
JDK 8.0_162
You can see that it works at ―― 8.
--Run Eclipse on a version of Java that is compatible with the version of the annotation processing code
--Attempted to automatically generate source code using JavaPoet during annotation processing
--The JavaPoet class used in the annotation process cannot be found and results in NoClassDefFoundError
.
--A library that depends on the factory path is not added in the annotation processing settings of Eclipse.
--Add the library used during annotation processing (JavaPoet in this case) to the factory path as well.
Recommended Posts