title: Using dependencyManagement with a local in project repository
body: <p>I have a project that is structured kind of like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>parent-project
  |-pom.xml
  |
  |-proj-A
  |   |-pom.xml
  |
  |-proj-B
  |   |-pom.xml
  |
  |-proj-C
  |   |-pom.xml (1)
  |   |-lib (2)
  |   |-proj-C-child-A
  |      |-pom.xml (3)
  |   |-proj-C-child-B
  |      |-pom.xml (3)
  </code></pre>
  
  <p><em>proj-A</em> and <em>proj-B</em> are both independent submodules of the parent-project.</p>
  
  <p><em>proj-C</em> has multiple sub-modules that depend on unmanaged libraries that cannot be retrieved from a remote repository.</p>
  
  <p>I tried to: </p>
  
  <ol>
  <li><p>import these JARs (<a href="https://devcenter.heroku.com/articles/local-maven-dependencies" rel="nofollow">using these instructions</a>) into the <strong>"lib (2)"</strong> folder shown above.</p>
  
  <pre class="lang-bash prettyprint-override"><code>mvn deploy:deploy-file \
      -Durl=&lt;path-to-proj-C&gt;/lib \
      -Dfile=&lt;path-to-the-external-jar&gt; \
      -DgroupId=&lt;groupId-for-jar&gt; \
      -DartifactId=&lt;artifactId-for-jar&gt; \
      -DrepositoryId=lib \
      -Dversion=&lt;version-for-jar&gt;
  </code></pre></li>
  <li><p>Add a <code>&lt;repositories&gt;</code> section to the <strong>proj-C pom.xml (1)</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;lib&lt;/id&gt;
          &lt;name&gt;local-filesystem-repository&lt;/name&gt;
          &lt;releases&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;checksumPolicy&gt;ignore&lt;/checksumPolicy&gt;
          &lt;/releases&gt;
          &lt;snapshots&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
          &lt;/snapshots&gt;
          &lt;url&gt;file://${project.basedir}/lib&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  </code></pre></li>
  <li><p>Add the dependency to the <code>&lt;dependencyManagement&gt;</code> section in <strong>proj-C pom.xml (1)</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;my-shiny-jar&lt;/groupId&gt;
              &lt;artifactId&gt;shiny-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  </code></pre></li>
  <li><p>Add dependency in the <strong>child modules (3)</strong> <code>&lt;dependencies&gt;</code> section</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;my-shiny-jar&lt;/groupId&gt;
          &lt;artifactId&gt;shiny-api&lt;/artifactId&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre></li>
  </ol>
  
  <p>This does not work. It fails to get the dependencies because it is looking for them in the submodule's lib directory instead of the parent where the repository is defined.</p>
  
  <pre class="lang-none prettyprint-override"><code>Downloading: file://&lt;path-to-proj-C&gt;/proj-C-child-A/lib/...
  ...
  ...Could not find artifact &lt;groupId&gt;:&lt;version&gt; in lib 
      (file://&lt;path-to-proj-C&gt;/proj-C-child-A/lib) -&gt; [Help 1]
  </code></pre>
  
  <p>It looks like it is using the project being built rather than the project where it is defined for the substitution of <code>file://${project.basedir}/lib</code> in the <code>&lt;repositories&gt;</code> element.</p>
  
  <p>What is the best way to deal this without using a remote repository?</p>