title: Maven: Resolving Duplicate Dependencies
body: <p>I'm developing an application that will be used internally at our company. In order for it to interop with our other internal systems I have to use some maven dependencies that we use internally, but this is causing some issues with using some external 3rd party dependencies that I also need.</p>
  
  <p>So essentially my pom looks like this:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          internal-framework-artifact
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          necessary-third-party-artifact
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I've come to find that both of these dependencies have the apache's <code>commons-collections</code> as one of their own dependencies (among a large number of others, but we'll just keep it at one for this question's simplicity).</p>
  
  <p>If I place exclusion rules on both of them for the <code>commons-collections</code> pom I can compile the project, but my resulting jar won't have access to either version of <code>commons-collections</code> and will just result in a <code>java.lang.NoClassDefFoundError</code> exception. Removing the exclusion rule on either of them just results in a mvn compiler error:  </p>
  
  <blockquote>
    <p>[WARNING] Rule 2: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with message:
    Duplicate classes found:</p>
  </blockquote>
  
  <p>I've been looking through various so q/a's and I can't really seem to find something that's 100% relevant to my situation. I'm really at a loss as to how to resolve this. Am I missing something really obvious?</p>