Wednesday, May 28, 2014

Same tomcat context file serving multiple workspace

In development we encounter a common scenario of working on multiple branches @ a same time. For this we generally keep multiple copies of context file for each branch.
Ex: We have two branch, that has code in workspace_one and workspace_two, so for running code from each branch we need two context file like below
<Context docBase="F:\workspace\workspace_one\xyz\target\endpoint-1.0.0-SNAPSHOT" >
</Context>
<Context docBase="F:\workspace\workspace_two\xyz\target\endpoint-1.0.0-SNAPSHOT" >
</Context>
Similarly if we are working on n no of  branches then there will be  n no of context files.

Solution:
-DAPP_PATH="F:\workspace\workspace_one"  set this in VM arguments either from command line from where you are running tomcat or in eclipse configuration under VM arguments.
Modified the single copy of context file:
<Context docBase="${APP_PATH}\xyz\target\endpoint-1.0.0-SNAPSHOT" >
 </Context>
So each time you just need to make change in VM arguments before starting the tomcat only. No need to switch all context files.

No comments:

Post a Comment