Skip to content
July 9, 2010 / edeustace

Quick bash script for expanding a war

A quick snippet that you can use to expand a war.
usage:

./expand.war MyWebapp.war

Will create a folder called MyWebapp.war that contains all your .war contents.

warName=$1
echo "expanding: $warName"
tmpFolder="_expanded"
mkdir $tmpFolder
echo "copying war to $tmpFolder"
cp $warName "$tmpFolder/$warName"
cd $tmpFolder
#you may need to change this to point to your java executable
/opt/java/bin/jar -xvf $warName
rm $warName
cd ..
rm $warName
mv $tmpFolder $warName

To use, just copy this code into a file on your linux box. Save it as expand.war.sh, then chmod on the file to make it runnable:

chmod a+x expand.war.sh

Then run it as in the above example.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: