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.
April 16, 2008
·
polesen ·
2 Comments
Tags: maven · Posted in: Tools

2 Responses
Thanks for the great tip. Saved me some time.
btw: I seldom have this need anymore, cause I tend to use “mvn deploy:deploy-file” now, which can be told to generate the checksums and poms.
Leave a Reply