Skip to content

Instantly share code, notes, and snippets.

@buckett
Created May 25, 2017 09:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buckett/8d409f3ff483e276414f139423886731 to your computer and use it in GitHub Desktop.
Save buckett/8d409f3ff483e276414f139423886731 to your computer and use it in GitHub Desktop.
Looks for TLD files inside JAR files for Tomcat jar scanning configuration.
#!/bin/bash
# This attempts to look in all the jar files for any tag library description files (tlds).
# This is useful because to speed up tomcat startup you can stop if scanning everything
# and then add back in the files that are needed.
# This needs to be run on a tomcat folder that has unpacked wars as it won't find JARs inside
# WARs.
# It outputs the pattern to put in the `tldScan` attribute of the JAR scanner
# http://tomcat.apache.org/tomcat-8.5-doc/config/jar-scan-filter.html
( find . -name \*.jar | while read file; do
if unzip -l $file | grep -q 'META-INF/.*\.tld'; then
basename $file
fi
done ) | sed -E 's/([0-9]+[\._-]?)+(RELEASE|SNAPSHOT)?/*/;s/\*jar/*.jar/' | sort | uniq | paste -sd ',' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment