title: How to build a module and its submodules using maven reactor?
body: <p>I have a project with three levels of modules. Let's suppose it has the following organization ...</p>
  
  <pre><code>+-- maven-root
     +-- maven-module-1
     |   +-- maven-submodule-1-1
     |   +-- maven-submodule-1-2
     +-- maven-module-2
     |   +-- maven-submodule-2-1
     |   +-- maven-submodule-2-2
     +-- maven-module-3
         +-- maven-submodule-3-1
         +-- maven-submodule-3-2
  </code></pre>
  
  <p>Additionally, we have the following set of dependencies</p>
  
  <ul>
  <li><code>maven-module-2</code> depends upon <code>maven-module-1</code></li>
  <li><code>maven-module-3</code> depends upon <code>maven-module-3</code></li>
  </ul>
  
  <p>In this structure, and supposing artifacts for <code>maven-module-1</code> and its submodules are already available in local repository, is there a solution using maven reactor (as an example) to build only <code>maven-module-2</code> and its submodules ?</p>
  
  <p>I already know that, using maven reactor, if I do</p>
  
  <pre><code>mvn clean install -pl :maven-module-2 --also-make-dependant
  </code></pre>
  
  <p>It will build</p>
  
  <ol>
  <li>maven-module-2</li>
  <li>maven-submodule-2-1</li>
  <li>maven-submodule-2-2</li>
  <li>maven-module-3</li>
  <li>maven-submodule-3-1</li>
  <li>maven-submodule-3-2</li>
  </ol>
  
  <p>as <code>maven-module-3</code> have a dependency upon <code>maven-module-2</code></p>
  
  <p>And obviously, running </p>
  
  <pre><code>mvn clean install -pl :maven-module-2 --also-make
  </code></pre>
  
  <p>will only build <code>maven-module-1</code> and <code>maven-module-2</code>.</p>
  
  <p>So, how, using that project organization, can I build only <code>maven-module-2</code> ?</p>