Contact Us 1-800-596-4880

Documenting Mule Extensions

Based on the Java Doclet standard, the new documentation generation facility permits mixing of Java code and XML. Along with several improvements, it is possible to run a search across the documentation.

If the project was created using the provided Maven archetype, there is no need for any additional configuration; DevKit generates the documentation by running a command (see below) at the root of the project. DevKit stores the documentation in the target/apidocs directory. Access this directory in your browser to publish the documentation on your website.

Federicos-MacBook-Pro:myproject federico$ mvn javadoc:javadoc

Configuring Documentation Generation

Where a project does not contain the necessary configuration to generate the documentation, you must manually set up the pom.xml file to do so. The following is an example taken from the Twilio Cloud Connector.

<build>
         <plugins>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <docletArtifact>
                        <groupId>org.mule.tools.devkit</groupId>
                        <artifactId>mule-devkit-doclet</artifactId>
                        <version>${mule.devkit.version}</version>
                    </docletArtifact>
                    <doclet>org.mule.devkit.doclet.Doclava</doclet>
                    <bootclasspath>${sun.boot.class.path}</bootclasspath>
                    <additionalparam>
                        -hdf project.artifactId "${project.artifactId}"
                        -hdf project.groupId "${project.groupId}"
                        -hdf project.version "${project.version}"
                        -hdf project.name "${project.name}"
            -hdf project.repo.name "${project.distributionManagement.repository.name}"
            -hdf project.repo.id "${project.distributionManagement.repository.id}"
            -hdf project.repo.url "${project.distributionManagement.repository.url}"
            -hdf project.snapshotRepo.name "${project.distributionManagement.snapshotRepository.name}"
            -hdf project.snapshotRepo.id "${project.distributionManagement.snapshotRepository.id}"
            -hdf project.snapshotRepo.url "${project.distributionManagement.snapshotRepository.url}"
                        -d ${project.build.directory}/apidocs
                        -htmldir ${basedir}/doc
                    </additionalparam>
                    <useStandardDocletOptions>false</useStandardDocletOptions>
                    <additionalJOption>-J-Xmx1024m</additionalJOption>
                </configuration>
            </plugin>
            ...
         </plugins>
      </build>

Verifying XML in Generated Documentation

DevKit uses the @sample.xml tag to analyze the content of a snippet introduced in the source code.
It does not execute the XML, though it does ensure that the XML sample parses successfully against the generated schema.