20120628 updating war files - plembo/onemoretech GitHub Wiki
title: Updating war files link: https://onemoretech.wordpress.com/2012/06/28/updating-war-files/ author: lembobro description: post_id: 2928 created: 2012/06/28 06:42:42 created_gmt: 2012/06/28 10:42:42 comment_status: closed post_name: updating-war-files status: publish post_type: post
Updating war files
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. An example: 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
Copyright 2004-2019 Phil Lembo