I have a web application that relies on some resources and parameters to be configured after it is installed, like a JDBC connection.
What I have come up with is pro
I don't know how to modify Tomcat's behaviour but I could think of 2 different solutions:
env to your build scripts and depending on the value it places the environment specific context.xml in your WAR during build.install script for each environment that first redeploys the WAR file (places it in webapps directory) and then makes modifications to the Tomcat installation depending on environment, e.g. different hostname for JDBC DataSource in context.xml.I make heavy use of the latter approach as it works in enterprise environments. Separation of duties policies often prohibit the dev team from knowing e.g. production database passwords. Option #2 solves this problem because only IT operations have access to the environment specific install scripts after they have been created.