TLD Generation for a Tag Library Packaged in a JAR File

To configure the generation of a TLD descriptor for a Tag Library packaged in a JAR file, add the following to your pom.xml file:

Add the compile dependency

<project>
  ...
  <build>
    ...
    <dependencies>
      ...
      <dependency>
        <groupId>com.squeakysand.jsp</groupId>
        <artifactId>squeakysand-jsp</artifactId>
        <version>0.6.0</version>
      </dependency>
      ...
    </dependencies>
    ...
  </build>
  ...
</project>

This artifact contains the com.squeakysand.jsp.tagext.annotations package necessary to add the needed annotations to your Tag implementation classes.

Add the plugin declaration

<project>
  ...
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>com.squeakysand.jsp</groupId>
        <artifactId>jsptld-maven-plugin</artifactId>
        <version>0.6.0</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <shortName>...</shortName>
          <processTagFiles>true</processTagFiles>
        </configuration>
      </plugin>
    </plugins>
    ...
  </build>
  ...
</project>

The shortName configuration parameter is compulsory and maps directly to the short-name element in the .tld file (there is no default value for the shortName parameter).

The processTagFiles parameter tells the plugin to look for *.tag and *.tagx files in the default location to be included in the generated .tld file. The default file pattern and location can be overridden with additional parameters. The default value for the processTagFiles parameter is false.

To generate a valid TLD file you must also provide a valid uri for the Tag Library. By default the plugin will use the value of the <uri> element in your pom.xml file (this may be inherited from a parent pom if you do not define one explicitly). If you do not have a <uri> element or you wish to use a different value, you will need to add an extra configuration element called <uri> to the plugin's configuration.

See the jsptld:generate page for additional parameters that can be passed.