title: Setting up Maven to allow deployment to different repositories easily
body: <p>I'm currently working in an environment where I define the rules for a lot of people. We currently use Hudson and Artifactory, and I want to evaluate if the switch to Jenkins and Nexus are worth the migration cost (but this is not the question).</p>
  
  <p>To eval it, I have setup Maven, Jenkins, and Nexus locally, and I try to find a setup to use as much of the previous setup, so that I can compare the solutions. The problem here is:</p>
  
  <ul>
  <li>When I use an existing POM and build and deploy it through Jenkins, it is automatically deployed to our old environment.</li>
  <li><p>I have then tried to define the <code>deploymentManagement</code> section in my <code>.settings</code> file in Maven, but this is not allowed (see <a href="http://maven.apache.org/guides/mini/guide-configuring-maven.html" rel="noreferrer">Configuring Maven</a>, there</p>
  
  <blockquote>
    <p>Note: the installation and user configuration cannot be used to add shared project information - for example, setting  or  company-wide.</p>
  </blockquote></li>
  <li>I could of course copy the whole, and change the distributionManagement inside each POM, but I would like to use the same (not a copied) example in different installations.</li>
  </ul>
  
  <p>Our current root POM contains the following section:</p>
  
  <pre><code>&lt;distributionManagement&gt;
      &lt;repository&gt;
        &lt;uniqueVersion&gt;false&lt;/uniqueVersion&gt;
        &lt;id&gt;company-central&lt;/id&gt;
        &lt;name&gt;Company central maven respository&lt;/name&gt;
        &lt;url&gt;https://company.com/artifactory/libs-releases&lt;/url&gt;
      &lt;/repository&gt;
      &lt;snapshotRepository&gt;
        &lt;id&gt;company-snaps&lt;/id&gt;
        &lt;name&gt;company-snapshots&lt;/name&gt;
        &lt;url&gt;https://company.com/artifactory/libs-snapshots&lt;/url&gt;
      &lt;/snapshotRepository&gt;
      &lt;downloadUrl&gt;https://company.com/artifactory/libs-releases&lt;/downloadUrl&gt;
    &lt;/distributionManagement&gt;
  </code></pre>
  
  <p>What is the easiest way to use the same POM, but to deploy it to different repository managers?</p>
  
  <p>PS: I have read <a href="https://stackoverflow.com/questions/9088846/set-up-maven-pom-file-for-different-deployment-scenarios">set up maven pom file for different deployment scenarios</a> and don't like it (in my context), <a href="https://stackoverflow.com/questions/13564180/deploying-maven-artefact-to-multiple-repositories-with-different-settings">Deploying Maven artifact to multiple repositories with different settings</a> is really a different question. <a href="https://stackoverflow.com/questions/635154/multiple-deployments-in-maven">Multiple deployments in maven</a> is an interesting approach, but I would have to modify a lot of POMs only for this purpose.</p>