Are there any built in mechanisms to backup a war file on deploy in Tomcat?
For example, I deploy whosit.war. I want the current whosit.war that's deployed to backup to whosit-backup.war. Or if each deploy kept an extra copy of the deploy at whosit-deploy-20110317-211037.war. etc etc.
Obviously I could add this to my deploy script but it would make my life so nice if Tomcat did anything like the above.
You can tag a deploy when deploying a webapp remotely by specifying the
tag
attribute. If you're using Maven you can specify the tag with the tomcat-plugin. Assuming you already have the plugin setup you need only to specify the property. Example:This will create a copy of the war in the work directory of your manager in a directory named after your tag (e.g.
$CATALINA_HOME/work/Catalina/localhost/manager/mytag
). You can retrieve and redeploy this war through the manager by specifying thepath
andtag
:Note: if the manager work directory ever gets deleted then your tagged deploys will be gone.
I think you'll have to script this up yourself.