We built some war files for our web server a while back and have now rebuilt them.
To ensure that nothing has changed (and as a quality check), we tried to compare them using WinMerge. The differences we can see look like they are due to some kind of meta data e.g. the files being built on different dates?
The difference in the lines seems to be consistent e.g.
«d}<
and
³Ze<
The war files are still both the same size.
Is there a way to compare them that strips out the meta data such as date?
I generally use an approach like this and run 2 unzip commands and diff the output as required. For example I need to compare 2 Java WAR files.
$ sdiff --width 160 \
<(unzip -l -v my_num1.war | cut -c 1-9,59-,49-57 | sort -k3) \
<(unzip -l -v my_num2.war | cut -c 1-9,59-,49-57 | sort -k3)
Resulting in output like so:
-------- ------- -------- -------
Archive: Archive:
-------- -------- ---- -------- -------- ----
48619281 130 files | 51043693 130 files
1116 060ccc56 index.jsp 1116 060ccc56 index.jsp
0 00000000 META-INF/ 0 00000000 META-INF/
155 b50f41aa META-INF/MANIFEST.MF | 155 701f1623 META-INF/MANIFEST.MF
Length CRC-32 Name Length CRC-32 Name
1179 b42096f1 version.jsp 1179 b42096f1 version.jsp
0 00000000 WEB-INF/ 0 00000000 WEB-INF/
0 00000000 WEB-INF/classes/ 0 00000000 WEB-INF/classes/
0 00000000 WEB-INF/classes/com/ 0 00000000 WEB-INF/classes/com/
...
...
I prefer this approach since it doesn't require space to uncompress the files and then compare them.
It should be easier if you unzip them first and then compare folders.
In Windows you could just use the 'jar' executable which comes with the jdk
jar -xvf xxxx.war
Then you can use WinMerge to compare the 2 folders.
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With