title: Conflict between maven managed dependency and declared one with different names
body: <p>I'm running a Websphere 7 project. Pom structure is the following:</p>
  
  <h2>my project</h2>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;parent&gt;
      &lt;groupId&gt;company&lt;/groupId&gt;
      &lt;artifactId&gt;websphere-superpom&lt;/artifactId&gt;
      &lt;version&gt;version&lt;/version&gt;
  &lt;/parent&gt;
  &lt;dependencies&gt;
      ...
      &lt;dependency&gt;
          &lt;groupId&gt;javax.el&lt;/groupId&gt;
          &lt;artifactId&gt;javax.el-api&lt;/artifactId&gt;
          &lt;version&gt;2.2.5&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  ...
  </code></pre>
  
  <h2>websphere-superpom</h2>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependencies&gt;
      ...
      &lt;dependency&gt;
          &lt;groupId&gt;com.ibm.websphere&lt;/groupId&gt;
          &lt;artifactId&gt;runtime-dependencies&lt;/artifactId&gt;
          &lt;version&gt;version&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <h2>runtime-dependencies</h2>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependencies&gt;
      ...
      &lt;dependency&gt;
          &lt;groupId&gt;com.ibm.websphere&lt;/groupId&gt;
          &lt;artifactId&gt;j2ee&lt;/artifactId&gt;
          &lt;version&gt;version&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Artifact j2ee contains several packages, among them there is also <code>javax.el</code> and it is loaded before the one I declare in my project's pom.</p>
  
  <p>I run a JUnit test with the option <code>-verbose:class</code> and the output confirmed this problem.</p>
  
  <pre class="lang-xml prettyprint-override"><code>[Loaded javax.el.ExpressionFactory from file:/C:/Program Files (x86)/IBM/SDP/runtimes/base_v7/lib/j2ee.jar]
  </code></pre>
  
  <p>I then run the following command in Maven console:</p>
  
  <pre class="lang-xml prettyprint-override"><code>mvn dependency:analyze -DcheckDuplicateClasses
  </code></pre>
  
  <p>and the output I got is this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>[WARNING] Unused declared dependencies found:
  ...
  [WARNING]    javax.el:javax.el-api:jar:2.2.5:compile
  ...
  </code></pre>
  
  <p>How to tell Maven to load ExpressionFactory from the library I declared in my project's pom? I cannot change websphere-superpom because it's a company managed artifact.</p>
  
  <p>EDIT:
  As asked by watery I tried to redeclare the offending dependency in my project's pom as following:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;com.ibm.websphere&lt;/groupId&gt;
      &lt;artifactId&gt;runtime-dependencies&lt;/artifactId&gt;
      &lt;version&gt;version&lt;/version&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;com.ibm.websphere&lt;/groupId&gt;
              &lt;artifactId&gt;j2ee&lt;/artifactId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>But then Maven tells me:</p>
  
  <pre class="lang-xml prettyprint-override"><code>Could not resolve dependencies for project ....: Failure to find com.ibm.websphere:runtime-dependencies:jar in nexus url
  </code></pre>