title: Maven child module in parent pom as dependency
body: <p>I'm trying to create a maven spring-boot project with multiple modules. I have created a parent module with packaging type <strong>pom</strong> and many children submodules with packaging type <strong>jar</strong>.</p>
  
  <p>So my parent's <strong>pom.xml</strong> looks like:</p>
  
  <pre><code>&lt;groupId&gt;Creator&lt;/groupId&gt;
      &lt;artifactId&gt;DPAI&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;modules&gt;
          &lt;module&gt;starter&lt;/module&gt;
          &lt;module&gt;DatabaseApi&lt;/module&gt;
          ...
      &lt;/modules&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.2.4.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>One of submodules: starter contains only starting class annotated with @SpringBootApplicatoion and in its pom.xml there is a  section with other child artifacts like:</p>
  
  <pre><code>    &lt;parent&gt;
          &lt;artifactId&gt;DPAI&lt;/artifactId&gt;        
          &lt;groupId&gt;Creator&lt;/groupId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
  &lt;artifactId&gt;starter&lt;/artifactId&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
   &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;Creator&lt;/groupId&gt;
              &lt;artifactId&gt;DatabaseApi&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
  ...
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>So I'm trying to do some refactoring and move Main.class and all dependencies to my parent's pom, but it doesn't compile with error with message that my dependencies referencing itself.</p>
  
  <p>In my opinion, the problem is that my parent pom contains  section with it's own submodules. Parent of that submoduls is the same pom, where I try to add described dependencies</p>