title: Automated Deployment of Server-Specific Configurations
body: <p>I have some Java projects that use Apache Commons Configuration and they get deployed to multiple servers in multiple environments (dev/test/prod).</p>
  
  <p>All code is the same, but some config items change, such as JMS URLs (dev should point to dev, etc) as well as the server name and environment (I use these config items for debugging).</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;config&gt;
      &lt;!-- environment can be dev|test|prod --&gt;
      &lt;environment&gt;dev&lt;/environment&gt;
  
      &lt;serverName&gt;myServer1&lt;/serverName&gt;
  
      &lt;jmsUrl&gt;http://my-jms-url-dev1,http://my-jms-url-dev2&lt;/jmsUrl&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>Currently, I deploy, build, then edit the files manually to provide the server-specific configurations. I want a way to automate this when I deploy it to individual servers, but all the ways I've considered require an equal amount of pain to setup.</p>
  
  <ul>
  <li><p>ANT - Check out the project with SVN and build it on each server with ANT. ANT reads the server name and the environment from two static files - .servername and .environment - and copies a server-specific config to the generic config. The problem with this is, I still have to create a config file for each server (I have 24 servers, and this may increase, so scalability is not good).</p></li>
  <li><p>SVN - Branch each of my projects to a server-specific distribution. Here, scalability is worse and it becomes a nightmare to maintain.</p></li>
  </ul>
  
  <p>Does anybody have any tips for me?</p>