I'm modifying a build process and I need to do a complete comparison of the contents of two .ear
files. That mea开发者_开发技巧ns recursively comparing each archive in the .ear
. These .ear
files have archives that contain archives.
I've looked at Beyond Compare and Archive Analyzer, but they only do one level at a time. I have to manually drill down into each archive. I'm looking for something more automatic.
Eclipse and UltraCompare do a binary comparison of the two .ears which is not what I want.
How can I compare two .ear
files recursively?
zipdiff provides a very good open source solution.
My problem turned out to be more than just expanding the .ear file recursively (I wrote a Java class to do that - recursion made it simple.) Once the .ear files are expanded I have to diff the directories to check for any changes. If anything other than timestamps changed then I know that the build is producing a different binary.
The second problem is that our build process generates hundreds of .xml files and subsequent builds re-generate those .xml files with the elements in different order. I'm not sure why. When I expand two .ear files made by back-to-back builds with no changes to anything the diff of the resulting directories shows hundreds of .xml files with diffs, even though they are functionally equivalent.
In addition to expanding the .ear files recursively I need to do a diff and exclude the .xml files in certain directories. I thought that Cygwin diff would do this, but the --exclude switch doesn't recognize any path information:
Cygwin diff won't exclude files if a directory is included in the pattern
If I don't find a solution to this I'll write another Java class to step through the whole directory structure doing a single level diff in each directory and excluding the .xml files in the appropriate directories.
I have the feeling that I'm re-inventing the wheel, but I can't find a wheel right now.
In Beyond Compare go into the Session Settings
dialog, and on the Handling
tab is an Archive Handling
option. If it's set to As folders always
BC will treat archives just like folders, so it's fully recursive.
精彩评论