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.

./expand.war MyWebapp.war

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

echo "expanding: $warName"
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, then chmod on the file to make it runnable:

chmod a+x

Then run it as in the above example.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: