Access javadoc programmatically

This tar ball (export-doclet-0.1.tar.gz) contains two maven project artifacts. It shows how to access the javadoc information of a project during the maven lifecycle phase ‘generate-sources’, traverse it, fill a Java object structure (export-doclet-api), marshal it to XML and include it into the jar of the artifact. Later on, you will be able to unmarshal the javadoc information. The export-doclet-api is oriented towards the doclet-api and the reflection-api and may therefore be familiar to you.

You can build the project like this:

export-doclet$ mvn clean install

Afterwards change to your project directory and add the following lines to your pom:

<!-- ... -->
	<!-- ... -->
				<additionalparam>-dest ${}/generated-resources/${project.groupId}_${project.artifactId}.xml</additionalparam>
<!-- ... -->

Last but not least, you should build your project artifact:

myproject$ mvn package

If the project builds successfully the target directory should contain a generated-resources directory containing an xml file named ${groupid}_${projectid}.xml. This file contains the marshalled javadoc information . It will be copied to the classpath root of the jar file of your artifact.

Leave a Reply

Your email address will not be published. Required fields are marked *