Hi Russ,

Does anybody have a working example of custom annotation processing in
> Maven that they could share? I'm finding the documentation on this to be
> frustratingly sparse. I can find a page claiming to describe a plugin for
> annotation processing, but it doesn't actually give examples of what it's
> supposed to do or how to use it.
>

I agree that documentation on custom annotation processing is hard to find.

My team uses a library called SezPoz (http://sezpoz.java.net/) which
provides a custom annotation processor, which operates at compile time
using Java6's Pluggable Annotation Processing API.

Since command-line Maven uses the installed system Java, which will usually
be either Oracle's Javac or the OpenJDK one, such custom annotation
processors will function as long as you are running at least Java6. (With
Java5 it is also possible, but you have to jump through some extra hoops.)

So for my team, our SezPoz-related annotations "just work" with no
additional configuration within Maven whatsoever.

If you need to write your own custom annotation processor, you could study
the SezPoz source code for a working example.

For further reading, you can check the Javadocs:

http://docs.oracle.com/javase/6/docs/api/javax/annotation/processing/Processor.html

If you meant some sort of Maven-specific custom annotation processing, then
I don't know of such a feature. But as I said, Maven (via Javac) should
invoke your annotation processors out of the box.

HTH,
Curtis

P.S. Beware of Eclipse: it does not run compile-time annotation processors
automatically, but must be specifically configured to do so:

http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_apt_getting_started.htm
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=280542

For our projects with SezPoz, we commit two key files to the VCS to force
Eclipse to behave properly immediately (rather than needing to dig around
in the Eclipse project settings UI):
    https://github.com/imagej/imagej/blob/master/core/core/.factorypath

https://github.com/imagej/imagej/blob/master/core/core/.settings/org.eclipse.jdt.apt.core.prefs


On Tue, Apr 3, 2012 at 10:17 AM, Russell Gold <russell.g...@oracle.com>wrote:

> Does anybody have a working example of custom annotation processing in
> Maven that they could share? I'm finding the documentation on this to be
> frustratingly sparse. I can find a page claiming to describe a plugin for
> annotation processing, but it doesn't actually give examples of what it's
> supposed to do or how to use it.
>
> Also, how do you search the mailing list archives? I had expected that to
> be a FAQ, but there doesn't appear to be a FAQ for this list.
>
> Thanks in advance,
> Russ
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to