Tech Per » Automatic MD5 File Generation for Maven Repository
Automatic MD5 File Generation for Maven Repository
If you have a local repository for your own, in-house developed, artifacts, you might also sometimes have the need to generate MD5 sum files for these, to avoid maven warnings when downloading. I know I have this need, when I put some artifact from the outside world into my local repository. The other day, I wrote a small bash-script, which recursively goes through maven repository artifacts and generates MD5 sum files for those missing. Here is the script code:
for ext in $@; do for jarfile in `find . -type f -name "$ext"`; do MD5_FILE=${jarfile}.md5 if [ ! -f ${MD5_FILE} ]; then md5sum $jarfile | cut -f1 -d" " > $MD5_FILE echo "generated missing: $MD5_FILE" fi done done
Say you put this into a script named gen-md5.sh, you would use it by doing ./gen-md5.sh "*.jar" "*.pom". The script depends upon the md5sum tool being installed.