title: How to deploy additional artifacts in maven without hardcoding a repository?
body: <p>In my maven pom, I have an additional jar-file that I'd like to include with my deployables.  I've got the jar-file building successfully, and I figured I'd use the maven-deploy-plugin, like so (version-wise, I'm using 2.8.2 from dependencyManagement):</p>
  
  <pre><code>    &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;deploy-special-jar&lt;/id&gt;
            &lt;phase&gt;deploy&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;deploy-file&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;repositoryId&gt;${project.distributionManagement.repository.id}&lt;/repositoryId&gt;
              &lt;url&gt;${project.distributionManagement.repository.url}&lt;/url&gt;
              &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
              &lt;artifactId&gt;${project.artifactId}&lt;/artifactId&gt;
              &lt;version&gt;${project.version}-special&lt;/version&gt;
              &lt;file&gt;${project.build.directory}/special.jar&lt;/file&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>This works great, but there's a slight issue.  If you notice,  the above pom is using project.distributionManagement.repository.url for both the repositoryId and url parameters.  However, this means that regardless of if I'm building a snapshot or a release version, I'm always deploying to me release-area, which is not ideal.  What if I'm building a snapshot?  Well, the answer seems to be to change project.distributionManagement.repository.url to project.distributionManagement.snapshotRepository.url</p>
  
  <p>I don't like the idea of changing these lines manually because I like to use the maven-release-plugin to switch between snapshot and release versions.  Now, I'd have to add some scripting to change these lines each time.  That's possible, but not ideal.</p>
  
  <p>It seems that someone asked about this exact problem before back in 2008, and there wasn't really a good answer:
  <a href="http://maven.40175.n5.nabble.com/problems-with-the-maven-deploy-plugin-td107307.html" rel="nofollow noreferrer">http://maven.40175.n5.nabble.com/problems-with-the-maven-deploy-plugin-td107307.html</a>
  So, I thought I'd add it here to see what people have come up with.</p>
  
  <p>I'm considering using the build-helper plugin to dynamically change this property, but that seems like a potential rabbit-hole, especially since
  someone tried to do something similar before (for other reasons, but the concept is similar):
  <a href="https://stackoverflow.com/questions/16694735/check-if-maven-pom-is-snapshot">Check if Maven pom is SNAPSHOT</a></p>
  
  <p>So, what's the right answer here?  Should this be a feature-request?  Or, is there a simple way to work around this problem that people use?  I'm curious what others have done.  Has anyone had any luck with the build-helper plugin?</p>
  
  <p>Thank you!</p>