This is more of a "note to self" than a "how to".
If you're trying to distribute tag files in a JAR, you need to put them under /META-INF/tags. You then need to create a TLD file that you also put under /META-INF/tags. If you have tags or functions that you created in Java, and want to distribute them alongside the tag files, you need to reference them in the TLD and package them in the same JAR (goes without saying).
If you want to do the same thing in maven, the location for the tag files and the tld file is different; you need to put them in src/main/resources/META-INF/tags. Then you can run mvn package and maven will create a JAR with your tags.
My directory structure in my maven project looks like this:
src `-- main |-- java | `-- net | `-- vivin | `-- regula | `-- validation | `-- util | `-- TagStringUtils.java `-- resources `-- META-INF `-- tags |-- generate-validation.tag `-- regula-spring.tld
And my TLD file looks like this:
<taglib> <tlib-version>1.0</tlib-version> <short-name>regula-spring</short-name> <uri>http://regula-spring</uri> <jsp-version>2.0</jsp-version> <tag-file> <name>generate-validation</name> <path>/META-INF/tags/generate-validation.tag</path> </tag-file> <function> <name>matches</name> <function-class>net.vivin.regula.validation.util.TagStringUtils</function-class> <function-signature>boolean matches(java.lang.String, java.lang.String, java.lang.String)</function-signature> </function> <function> <name>replaceUsingRegex</name> <function-class>net.vivin.regula.validation.util.TagStringUtils</function-class> <function-signature>java.lang.String replaceUsingRegex(java.lang.String, java.lang.String, java.lang.String, java.lang.String)</function-signature> </function> </taglib>