Tomcat: keeping specific files when deploying a WAR file

tomcatweb-applications

Is there a way to tell tomcat to keep specific files under a exploded WAR file's directory?

let's say I have the following folder that I've created after the WAR has been deployed:

/webapps/myApp/uploads

Everytime I deploy the WAR it is deleted. Is there a way to keep this directory and its files?

Best Answer

According to the Tomcat 6.0 deployment howto, the exploded webapp "is removed, and the .WAR is expanded again". So the whole /webapps/myApp/ directory gets deleted upon deployment. There is no way to keep the files in it.

If you want to keep the uploaded files, you should define a directory outside your webapp dir, and use that from within the web application.

Related Topic