title: Solving Maven dependency convergence issues
body: <p>I use the maven-enforcer-plugin to check for dependency convergence issues. A typical output would be:</p>
  
  <pre class="lang-none prettyprint-override"><code>[WARNING] Rule 1: org.apache.maven.plugins.enforcer.DependencyConvergence failed 
    with message:
  Failed while enforcing releasability the error(s) are [
  Dependency convergence error for junit:junit:3.8.1 paths to dependency are:
  +-foo:bar:1.0-SNAPSHOT
    +-ca.juliusdavies:not-yet-commons-ssl:0.3.9
      +-commons-httpclient:commons-httpclient:3.0
        +-junit:junit:3.8.1
  and
  +-foo:bar:1.0-SNAPSHOT
    +-junit:junit:4.11
  ]
  </code></pre>
  
  <p>Seeing this message, I would normally "solve" it by excluding the transitive dependency, e.g.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
    &lt;groupId&gt;ca.juliusdavies&lt;/groupId&gt;
    &lt;artifactId&gt;not-yet-commons-ssl&lt;/artifactId&gt;
    &lt;version&gt;0.3.9&lt;/version&gt;
    &lt;exclusions&gt;
      &lt;!-- This artifact links to another artifact which stupidly includes 
        junit in compile scope --&gt;
      &lt;exclusion&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;/exclusion&gt;
    &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I'd like to understand whether this is truly a fix and the risks involved in excluding libraries in this fashion. As I see it:</p>
  
  <ul>
  <li><p>The "fix" is normally safe, provided I'm choosing to use the newer version. This relies on the library authors maintaining backwards compatibility.</p></li>
  <li><p>There is typically no impact on the Maven build (since the nearer definition wins), however by excluding the dependency I'm telling Maven that I know about this problem and thus appeasing the maven-enforcer-plugin.</p></li>
  </ul>
  
  <p>Are my thoughts correct and is there an alternative way of handling this issue? I'm interested in answers that focus on the general case - I realise the <code>junit</code> example above is a little strange.</p>