Doclava: Custom Javadoc Doclet from Google

Doclava is a custom Javadoc Doclet from Google, used by Google Guice (see their slight cooler Javadocs). Doclava uses JSilver as its templating engine, a pure-Java implementation of Clearsilver. I personally like the idea of Federated Documents to allow documentations to link and integrate to each other on open projects.

Here are the main differences between Doclava and the standard Doclet:

  • Refreshed look and feel, including search capabilities.
  • Embeds versioning information in the documentation.
  • Uses a templating engine for user customizations.
  • Throw build errors for things that can easily be caught, like @param tags that don’t match the parameter names.
  • Ability to include snippets of code from real source code
  • Federate documentation between multiple sites.
  • Ability to embed javadocs in a larger web page.

Using Doclava with Javadoc

-doclet -docletpath ${jar.file}

Using Doclava with Ant

  <target name="doclava" depends="jar">
    <javadoc packagenames="*"
      <doclet name="">
        <param name="-stubs" value="build/stubs" />
        <param name="-hdf"/> <param name=""/> <param name="Doclava"/>
        <!-- versioning -->
        <param name="-since"/> <param name="doclava/previous.xml"/> <param name="v1" />
        <param name="-apiversion" value="v2"/>
        <!-- federation -->
        <param name="-federate" /><param name="JDK"/>
        <param name=""/>
        <param name="-federationxml"/><param name="JDK"/>
        <param name=""/>

Using Doclava with Maven

            | bootclasspath required by Sun's JVM
             -federate JDK
             -federationxml JDK
             -hdf "${}"
             -d ${}/apidocs
            | Apple's JVM sometimes requires more memory

Improved Tags

Doclava supports a few extra tags such as @undeprecate (pretty self-explanatory), @hide (remove from the documentation), @include $filePath (includes text from file), @sample (includes sample from file) and a few different ones. Please see the complete list here.


And if you are tired of the old Javadoc look and feel, you can customize the output of Doclava. For more information click here.

Reference: Doclava: Custom Javadoc Doclet from Google from our JCG partner Felipe Oliveira.

Related Articles:

Related Whitepaper:

Bulletproof Java Code: A Practical Strategy for Developing Functional, Reliable, and Secure Java Code

Use Java? If you do, you know that Java software can be used to drive application logic of Web services or Web applications. Perhaps you use it for desktop applications? Or, embedded devices? Whatever your use of Java code, functional errors are the enemy!

To combat this enemy, your team might already perform functional testing. Even so, you're taking significant risks if you have not yet implemented a comprehensive team-wide quality management strategy. Such a strategy alleviates reliability, security, and performance problems to ensure that your code is free of functionality errors.Read this article to learn about this simple four-step strategy that is proven to make Java code more reliable, more secure, and easier to maintain.

Get it Now!  

Leave a Reply

6 × two =

Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books