I have annotation processing working in Eclipse for some of my projects; for me it works on saving, and I don't need mvn install (and it works differently than Maven, since Eclipse runs its own compiler).
I also use the m2e-apt plugin for this. As noted above, Eclipse launches its own compiler; this means that its output may be slightly different from Maven (when you "Right-click on the project> Run as> Maven Clean / Install" you call Maven, not Eclipse). I mention this because it is possible that your processors have problems and work in Maven, but not in Eclipse (although most of the time they produce the same output, I saw some differences, but very small ones). I would follow the Eclipse error log if I were you (because annotation processing errors are written there).
So here is what I suggest:
- Publish an image with Maven / Annotation Processing settings to Eclipse (even if you have the correct activation option).
- Place a snapshot with the
Java/Compiler settings (there is a checkmark that must be activated, it does not work without). pom.xml will be, oddly enough, useful. Especially if you have a custom configuration for maven-compiler-plugin . Some of these configurations are interpreted by m2e-apt , for example, compiler arguments.- Locate the file called
.factorypath . That m2e-apt stores a list of banners that it scans for processing annotations (you will find there all the banks of your project, even if they actually do not contain processors, that is, if your maven-compiler-plugin not configured as such, consider only specific list of processors). If the jug containing your processor is not in the .factorypath , it will not work. - Last but not least, there is one more thing that can cause problems. If the project containing the actual annotation processor (so NOT the client) is in the same workspace as the client project, then
m2e-apt will simply ignore your annotation processor; I do not know why. Closing your annotation processor project would be sufficient in this case (you do not need to remove it from the workspace).
Edit: Forgot to say that if you are processing annotations through Maven (and you only call Maven to process annotations) then mvn compile should be enough. In addition, you do not need to run it separately (first mvn clean , then mvn compile ). You can run it in one shot using mvn clean compile ; it should have the same effect.
source share