tags:

views:

51

answers:

4
+2  Q: 

Exploding ROOT.war

I am copying my ROOT.war file to webapps of Tomcat 6.0 . Is there a way I can explode the file upon copying. i.e when my script copies it in the webapps .. it should explode and create ROOT directory ??

+2  A: 

There are two ways that come to mind.

One is that the WAR file is a jar file, so you can use the jar command to expand it.

The other is to use the Tomcat autodeploy magic. You copy the WAR file in; Tomcat notices the change, expands the WAR, and reloads it.

William Pietri
+1  A: 

The Ant task unzip/unjar will also do the trick as the WAR file is JAR/ZIP

Miro A.
A: 

Simple, but you could always do:

cp blah.jar /usr/local/tomcat/webapps && unzip blah.jar

It assumes Unix, on windows you should be able to do something similar...

Jon
Thanks guys !!! Actually when I copied the .war into webapps .. it automatically gets explode and it's just that it was taking up a minute to get exploded !!! Thanks again for all the answersCheers!
A: 

You should not be putting your stuff in ROOT context. Create a war named Foo.war and let "Foo" be the name of your context.

duffymo
Why's that? When I want things at the root, which is normally the case, I put them in ROOT and it works fine.
William Pietri
I don't think applications belong in ROOT. They should have their own context.
duffymo
I understand that you think that. I'm asking why anybody else should think that. If you only have one app in that Tomcat, then ROOT is its own context. Works fine for me, anyhow.
William Pietri