It's been years since I've worked with tomcat, so please forgive me my newbie questions ....
I wish to make sure that each time I call "ant deploy", that I get a really clean, fresh, installation into tomcat. My guess is that tomcat supports autoloading of new war file but that it might be a bit shaky. So I'm guessing that my deploy should ask tomcat to shut down, then I would need to remove all of the old files where tomcat unpacked my old war file, then copy over the new war file and then start tomcat back up again.
Does this sound right?
Does anybody have any ant snippets of doing something like this?
I haven't come across any issue of just copying the file and allowing it to be redeployed. For instance, using JBoss, the only time I have had to reboot the server is when I have a dependency on a .jar file that is in the lib directory of the server, and not in the "app". But within an ear or a war they work fine.
That situation of rebooting had to do with which class loader actually loaded the classes from the jar file. And since the jar in the server's lib directory is loaded by a different classloader than the app's .ear or war file class loader, it causes a problem.
But, in the end redeploying just a .war or .ear file should work fine without having to reboot the server.
I've used Tomcat's Ant Tasks for this type of thing in the past. Prior to Tomcat 5.5 everything seemed to work great. However, since 5.5 they don't have the same behavior. I start up tomcat like normal. I can run the deploy task and it basically copies my WAR file to the webapps folder. This works fine. But after that point, things don't work.
If I run the stop task, which just stops the webapp, not tomcat, and then execute the start task, it doesn't start back up and I get SEVERE errors. If I try and undeploy, it removes everything except what Tomcat has a hold of such as JAR files and the context.xml file. Then trying to deploy after that I get more errors and exceptions.
So I am at a loss as to what to do. Mark's suggestion isn't working either. Simply copying the WAR file into the webapps folder again throws more errors and exceptions at time. I honestly think this aspect of Tomcat is rather buggy.