Summary
How can you make ant repeatedly generate byte-identical jar files from the same .class files?
Background
Ou
Had this same problem, landed on this page. The answer above by Jiri Patera was very helpful in understanding why I could not get the md5sums of what I expected to be two identical files to be the same after unsigning and resigning the jar files.
This is the solution I used instead:
jar -tvf $JARFILE | grep -v META-INF | perl -p -e's/^\s+(\d+).*\s+([\w]+)/$1 $2/g' | md5sum
It doesn't give 100% certainty that the jars are equivalent but it gives a fairly reliable indication.
It takes a listing of all the files in the jarfile minus the META_INF files, parses out file size and file name, and then runs the text of filesizes plus filenames thru the md5sum algorithm.