My JSF Project is deployed as an EAR file. It includes some war files also. I need an exploded version of the EAR (including exploded inner WARs).
Is there any tool to do it?
Programmatically, or manually? EAR and WAR files, like JAR files, are really just ZIP files with a known internal file/folder structure. That means you can extract EARs and WARs like any other ZIP file, with code or with a desktop application.
Command line tool for windows would be great.
Matt's answer was helpful, but sometimes it's nice to have it written out for you.
Here is a shell script that I wrote to solve this problem that I actually ran in Cygwin but would likely work in Linux also. It will unzip and wars, ears, or jars and keep unzipping them until recursively until none are left. You may want to then use "diff -r ear1.ear-contents ear2.ear-contents" on the resulting directories to compare two ear files.
#!/bin/sh
rm -rf ${1}-contents
mkdir ${1}-contents
echo "Unpacking ${1} to ${1}-contents"
unzip -d ${1}-contents ${1}
cd ${1}-contents
FILES_TO_PROCESS=`find . -type f \( -name "*.ear" -or -name "*.war" -or -name "*.jar" \)`
until [ "$FILES_TO_PROCESS" == "" ] ; do
for myFile in $FILES_TO_PROCESS ; do
mkdir ${myFile}-contents
echo "Unpacking ${myFile} to ${myFile}-contents"
unzip -d ${myFile}-contents ${myFile}
rm $myFile
done
FILES_TO_PROCESS=`find . -type f \( -name "*.ear" -or -name "*.war" -or -name "*.jar" \)`
echo "recursing to process files: $FILES_TO_PROCESS"
done
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