Wednesday, July 4, 2012

Packaging your TLDs with Maven

Packing your TLDs files with Maven can be very useful to allow systematic reuse of these resources. It is also fairly easy to accomplish.
First add the Maven resource plugin to your build. In pom.xml, locate (or create) the build/plugins section and add the following


No configuration needed if you respect the conventions shown below.
Resource files in Maven are by default located in folder src/main/resources. Include it in your build path if it isn't yet (if necessary, create it) as a resource folder.
Create the subdirectory META-INF under the src/main/resources and place your tld file here. Don't forget to specify the uri node, as follows

<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="" 
 xsi:schemaLocation="" version="2.0">


That's it! Now your TLD will be placed in your JAR.
Also using it is very simple. Just follow this link.

No comments:

Post a Comment