title: Maven cannot resolve dependency for module in same multi-module project
body: <p>When running commands such as </p>
  
  <pre><code>mvn dependency:build-classpath
  </code></pre>
  
  <p>or</p>
  
  <pre><code>mvn exec:java
  </code></pre>
  
  <p>Maven is unable to resolve a dependency of one of my modules on another. </p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal on project parser-app: Could not resolve dependencies for project project_group:A:jar:0.1-SNAPSHOT: Could not find artifact project_group:B:jar:0.1-SNAPSHOT</p>
  </blockquote>
  
  <p>The project structure is as follows:</p>
  
  <pre><code>/pom.xml
  /A/pom.xml
  /B/pom.xml
  </code></pre>
  
  <p>The parent pom is as follows:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;project_group&lt;/groupId&gt;
    &lt;artifactId&gt;parent&lt;/artifactId&gt;
    &lt;packaging&gt;pom&lt;/packaging&gt;
    &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
    &lt;name&gt;parent&lt;/name&gt;
  
    &lt;modules&gt;
      &lt;module&gt;A&lt;/module&gt;
      &lt;module&gt;B&lt;/module&gt;
    &lt;/modules&gt;
  </code></pre>
  
  <p>The first child module (the one failing to resolve the dependency):</p>
  
  <pre><code>    &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;parent&gt;
      &lt;groupId&gt;parent_group&lt;/groupId&gt;
      &lt;artifactId&gt;parent&lt;/artifactId&gt;
      &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
    &lt;/parent&gt;
    &lt;artifactId&gt;A&lt;/artifactId&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;name&gt;A&lt;/name&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;parent_group&lt;/groupId&gt;
        &lt;artifactId&gt;B&lt;/artifactId&gt;
        &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>The second child module (the dependency):</p>
  
  <pre><code>  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;parent&gt;
      &lt;groupId&gt;parent_group&lt;/groupId&gt;
      &lt;artifactId&gt;parent&lt;/artifactId&gt;
      &lt;version&gt;0.1-SNAPSHOT&lt;/version&gt;
    &lt;/parent&gt;
    &lt;artifactId&gt;B&lt;/artifactId&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;name&gt;B&lt;/name&gt;
  </code></pre>