Suppose you want to replace or add an image file to a deployable .war for customization purposes? What do you do? Simplified procedure below.
Unpacking and making changes to .war files can be a messy business. To reduce that messiness to a degree the first thing I do is make an important change to the procedures you’ll see across the Internet: I do the work on Linux instead of Windows.
The second thing is I don’t use 7-zip, WinZip or even plain vanilla zip to unpack and repack. I use good old jar.
The third thing I do is use jar’s update option rather than re-packing the entire file. Yes, it’s a bit slower and more tedious, but it has the advantage of being much more surgical and thus less risky.
MyLogo.gif needs to be added to the openam.war so it can be accessed by some custom code.
[webapp@test ~]$ mkdir /data/staging [webapp@test ~]$ cp /data/install/openam/openam.war /data/staging [webapp@test ~]$ cd /data/staging [webapp@test staging]$ jar xf openam.war [webapp@test staging]$ cp /data/projects/images/MyLogo.gif images/ [webapp@test staging]$ jar uf openam.war images/MyLogo.gif