title: Maven : Get rid of older dependency
body: <p>I have a maven based project called XYZ which has following dependency : </p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupid&gt;com.example.test&lt;/groupid&gt;
    &lt;artifactId&gt;PQR&lt;/artifactId&gt;
    &lt;version&gt;${version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>This PQR dependency has other maven dependency ABC of version 1.2
  When I use XYZ as dependency in another project, i want to use ABC version 1.4.</p>
  
  <p>I tried following:
  1) changing order of dependency:(explicitly adding ABC 1.4 dependency)</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.exampe.test&lt;/groupId&gt;
    &lt;artifactId&gt;ABC&lt;/artifactId&gt;
    &lt;version&gt;1.4&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupid&gt;com.example.test&lt;/groupid&gt;
    &lt;artifactId&gt;PQR&lt;/artifactId&gt;
    &lt;version&gt;${version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>2) Excluding ABC from PQR</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.exampe.test&lt;/groupId&gt;
    &lt;artifactId&gt;ABC&lt;/artifactId&gt;
    &lt;version&gt;1.4&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupid&gt;com.example.test&lt;/groupid&gt;
    &lt;artifactId&gt;PQR&lt;/artifactId&gt;
    &lt;version&gt;${version}&lt;/version&gt;
    &lt;exclusions&gt;
       &lt;exclusion&gt;
         &lt;artifactId&gt;com.exampe.test&lt;/artifactId&gt;
         &lt;groupId&gt;ABC&lt;/groupId&gt;
       &lt;/exclusion&gt;
    &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Both of this doesnt work.
  I still get version 1.2 in when I use XYZ as dependency.
  How can I get this right?</p>