title: Maven deploy two jars with different classifiers from two separate pom.xml
body: <p>I want to deploy two jar artifacts with different classifiers, but at the moment that fails because both supply their own version of <code>pom.xml</code>. How can I fix that, so that both <code>pom.xml</code>s can be uploaded along with their artifacts?</p>
  
  <p>Example - I have <code>com.test.company.somelib-1.0.0-cmp1.jar</code> and <code>com.test.company.somelib-1.0.0-cmp2.jar</code>, where <code>cmpX</code> is a classifier. Both packages contain (logically) the same code and classes (of the same version), they only differ slightly in the way they were preprocessed. The classifier annotation is there due to backwards compatibility we need to maintain.</p>
  
  <p>Long story short, first artifact uploads fine, second one fails with <code>Forbidden</code>, because our repository does not allow overwriting artifacts (and I want to keep it that way).</p>
  
  <p>There is a slightly different pipeline that creates both the packages, so it is easier to have their builds separate. I just want to deploy them as two packages of the same name and different classifier.</p>
  
  <p>Thanks for help</p>
  
  <hr>
  
  <p>Edit: it has been suggested to use Maven profiles. I can see that they would work, but they would not be ideal. </p>
  
  <p>Consider the setup I have depicted on the picture below - there is a CI server (TeamCity). </p>
  
  <ul>
  <li>There is a "starter" build (Sources). This build checkouts all required source files. </li>
  <li>From this starter build several other builds are triggered (<em>processing using x.x.x</em>/<em>compile</em>). Each of those builds <em>adjusts</em> a template-pom.xml (fills in particular <code>classifier</code> and other info), and then builds and deploys its artifact to our Artifactory.</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/wwJIh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wwJIh.png" alt="enter image description here"></a></p>
  
  <p>With the setup I want to achieve if I decide to add another <em>processing-build</em>, all I need to do is add another "branch". If I was using profiles, I would need to also add a new profile to the pom.xml file.</p>
  
  <p>Correct me if I am wrong please. Profiles seem to be able to achieve the goal, but not ideally, at least in my case.</p>