I'm not a big tomcat user, but our project is using it currently. We've committed a .xml configuration file that is placed in CATALINA_HOME\localhost, but get's updated rather often. I would much prefer to symlink this file into that CATALINA_HOME\localhost directory from our working directory. Unfortunately, the docBase path has to be modified per developer.
Is there a way to use environment variables in the docBase path so that developers can keep their projects where they please and our startup scripts can symlink the catalina xml configuration?
I would like something like this:
....
Here's what I did in Tomcat7 (I think you'll have no problem doing it in other versions of Tomcat):
in setenv.bat I added the following line:
set JAVA_OPTS=%JAVA_OPTS% -DAPP_PATH="c:\path\to\app"
in my webapp.xml (located in C:\path-to-apache-tomcat\conf\Catalina\localhost)
I did the following:
<Context docBase="${APP_PATH}\src\main\webapp">
Hope this helps!