eclipse annotation processor not working. Where are errors shown?

Viewed 3286

Although there are other answers that cover this in some way, I want to have it for someone else that has similar problem and does notice the solution.

After setting up my own annotation processor and it properly working via maven, I got annoyed by being forced to rebuild source with maven on each change that needs the processor to do some magic.

Setting up eclipse to use my annotation processor required me to close annotation processor project so m2e-apt can put processor jars into .factorypath .

But then it stopped working for some reason, and I could not find the reason,

2 Answers

The answer above is correct, but I'd like to put here more details about how to work logging in Eclipse + APT.

Eclipse takes into account only messages send through processingEnv.getMessager().printMessage. If you use printMessage without reference to an element the Eclipse will route your log message to the Workspace Log (Window -> Show view -> General -> Error Log). If you use the printMessage with element reference the Eclipse will route your message to the Problems view (Window -> Show view -> General -> Problems).

If there is some exception during APT rounds Eclipse will log it into the Workspace Log (Window -> Show view -> General -> Error Log)

Eclipse will ignore any other logging methods (e.g. log4j, slf4j, etc).

Related