How do you setup TLDDoc to create documentation for JSP TagLibs?
A company I work for currently has several taglibs across multiple projects. We use maven and hudson. I've been tasked to find something that we can use to auto-generate documentation for our taglibs. I've found TLDDoc but I haven't been able to find anything explaining how to set this up. Please note, I'm not a开发者_StackOverflow中文版 Java Developer, I'm a UI Developer that works in JSP among other technologies. Any help would be appreciated.
If you want to execute TLDDoc as maven plugin, you can do it e.g. like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>generateTldDoc</id>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<includeProjectDependencies>false</includeProjectDependencies>
<mainClass>com.sun.tlddoc.TLDDoc</mainClass>
<arguments>
<argument>-doctitle</argument>
<argument>Whatever Taglib</argument>
<argument>-windowtitle</argument>
<argument>Whatever Taglib</argument>
<argument>-d</argument>
<argument>${project.build.directory}/tlddoc</argument>
<argument>src/main/resources/META-INF/something.tld</argument>
<argument>src/main/resources/META-INF/somethingelse.tld</argument>
</arguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>taglibrarydoc</groupId>
<artifactId>tlddoc</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
I have had some similar requirement. What I did was to use an Ant script within the maven file, it would find all the TLD definition files under the projects I needed, and looped over each file and do something.
I needed to 2 outputs. HTML and DITA (technical documentation format, successor of DOCBOOK).
- For each TLD, the TLDDoc would be invoked and to an output directory that would be the same.
- An extra script executed an XSLT stylesheet that was transforming the TLD xml into DITA. From DITA I use the "DITA Open Toolkit" to output into PDF, and another type of HTML.
With maven you need to learn a little bit of ANT script, and know how to call java classes (TLDDOC) or the XSLT engine.
It was really cool, and quite flexible.
精彩评论