Related Tools

XDoclet's popularity has resulted in a number of related tools and APIs.

XDoclet Team


XJavaDoc is a clone of Sun's JavaDoc core. It is used by XDoclet and provides faster parsing of Java source files than Sun's JavaDoc.

XJavaDoc is also used by XDoclet GUI. XDoclet GUI takes advantage of XJavaDoc's code mutation capabilities (it can modify @tags programmatically).

Here is an example usage of the XJavaDoc API:

// Get a class
XClass fooBar = XJavaDoc.getInstance().getClass("foo.Bar");
// Get a method
XMethod doIt = clazz.getMethod("doIt(java.lang.String[],int)");
// Get the javadoc
XDoc doItDoc = doIt.getDoc();
// Get the value of a tag attribute
XTag zap = doItDoc.getTag("zap");
String zapBang = zap.getAttributeValue("bang");

XJavaDoc resides in a separate xjavadoc module in XDoclet's CVS tree.


CodeUnit is a JUnit extension that implements logic to compare two Java source files. It lets you compare two files on the AST level (strict), or on the API level (relaxed).

CodeUnit is intended to be used to test the output of Java code generators like XDoclet, Middlegen, UML2EJB and others.

CodeUnit is used by extending the xjavadoc.CodeTestCase class and calling the assertApiEquals or assertAstEquals methods from the various testXxx() methods. Everything you need is in the XJavaDoc jar file.

CodeUnit is currently not used by XDoclet 1.2.x, but it will be used in the upcoming XDoclet 2. It is also used in UML2EJB.

Look at the xjavadoc.CodeTest class in the XJavaDoc sources for an example.

XDoclet GUI

XDoclet GUI is a tag editor for existing source code. It provides a structured view of java classes and documentation tags. It utilizes formal tag descriptions (xtags) contained in xdoclet modules and will allow you to insert tags only into appropriate classes/methods. While at the moment XDoclet GUI is a standalone tool, plugins for specific IDEs such as Eclipse, IDEA, Forte/Netbeans, JBuilder etc. can be developed in future.

Click to zoom
Click to zoom

Source code is available in the XDoclet CVS, under the xdocletgui module.

Third Party


Middlegen is a free general-purpose database-driven code generation engine based on JDBC, Velocity, Ant and XDoclet. If you already have a database, you can use Middlegen to generate...

  • EJB (CMP 2.0)
  • JDO
  • JSP/Struts

Middlegen will (among other things) relieve you from the headaches involved with @ejb.relation tags. Support for Hibernate is on the way.


(Previously known as UML2EJB)

Did you ever think: "mmm... all this EJB stuff is too complex! There must be an easier way to program?" Read the good news: AndroMDA is here to help you! Generating EJBs quickly and reliably from models drawn in the graphical Unified Modeling Language is the main feature of AndroMDA.

AndroMDA generates java sources with XDoclet @tags from UML models.


JBossIDE is an Eclipse plugin with support for JBoss and XDoclet.


MockDoclet is an active code generation tool for automatically generating mock objects implementation classes from existing classes or interfaces in Java. Please note that this project is based on XDoclet 1.1.2 and is no longer maintained.

Stig Jrgensen has ported the old MockDoclet to XDoclet 1.2b3, and it's now a standalone XDoclet module!

XDoclet Templates

XDoclet Templates for Eclipse.


AppFuse: an application meant to demonstrate how to use XDoclet with Struts to generate your Forms, web.xml, struts-config.xml, and validation.xml. It's also designed to show how you can use the different security packages (i.e. form-based authentication, SSLExt) and advanced Struts techniques (i.e. Tiles, Validator) to build your webapps.


xPetStore: using XDoclet to implement Sun Microsystems' Java Pet Store J2EE BluePrint Application, this application is the ultimate example of XDoclet's power. Also uses Struts and SiteMesh.


JavaGen is an on-line code generator that processes UML models and generates EJB 2.0 CMP classes. The generated code is decorated with XDoclet attributes specific to JBoss 3.x. It is very similar to AndroMDA.


reverse-xdoclet is a tool to generate initial xdoclet tags out of ejb-jar.xml and the source files. Those files might be created by hand or with the help of your favourite IDE.