My goal is to "read" the Java classes of a certain package, then to process the Javadoc and annotations (preferably at the same time) on the classes within that package and on the methods within those classes. Solution must be implemented in Java 6 or 7, build tool is Maven 3. We're currently using the maven-compiler-plugin
, version 2.5.1
, but I can probably upgrade that further if available/necessary.
As I understand it, the purpose of the javax.annotation.processing
classes are to do this kind of thing, and I believe Java code along the lines of this other SO answer should work for my purposes, but the practical details of how to get it actually running are still a little fuzzy.
All that being said, here's what I think I need:
- Java code to pick out the annotations and Javadoc items that I want, and then convert those items into the data model needed to create my custom documentation.
- Java code to then write this data model out to a docs file or directory of files
- Maven 3 configuration to:
- Run the annotation processor once at a good time
- Include the generated docs directory in the outputted war file
The Maven bits trip me up more than the Java code, so if you're only going to answer half, that's the half that'll get my check mark. Also, my preference would be to not put this annotation processor into a Maven repository as a separate plugin since it will be very tightly coupled with some custom annotations we're using.
Here's a brief listing of questions that I found as related from which I could not synthesize my own answer, though: