Thursday, November 15, 2012

TLD Generator

I recently found a very useful project if you are building a Java library that contains tags or functions that you would like to expose within a JSP. TLD Generator - this tool allows one to configure your TLD by annotating your code and then it generates the TLD using an annotation processor. I thought that this was very useful so I worked with the author to get this published to maven central. If you wanted to use this in your maven project simply add a dependency like this:
<dependency>
    <groupId>com.google.code.tld-generator</groupId>
    <artifactId>tld-generator</artifactId>
    <version>1.1</version>
    <scope>compile</scope>
    <optional>true</optional>
</dependency>
The option element is key here in that Maven will not include the tld-generator as a dependent library - but it will put it on the class path during compile time so that the annotation processor will run. See the documentation on the TLD Generator's wiki for information how to annotate your code to generate the TLDs.

No comments: