title: How to use maven plugin tomcat7:run with multiple contexts (WARs)?
body: <p>I've been using <code>mvn tomcat7-maven-plugin:run -am -pl :foo</code> successfully to run just a single project at a time in <a href="http://tomcat.apache.org/maven-plugin-2/run-mojo-features.html" rel="noreferrer">Tomcat like is shown here</a>. Now I'd like to have multiple modules run under the same port but different contexts. For instance, I'd like to have:</p>
  
  <pre><code>/    =&gt; foo.war
  /bar =&gt; bar.war
  </code></pre>
  
  <p>Here's an example pom.xml snippet that I've been working with:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;project&gt;&lt;!-- ... --&gt;
      &lt;build&gt;&lt;!-- ... --&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.0-SNAPSHOT&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;path&gt;/&lt;/path&gt;
                          &lt;port&gt;8080&lt;/port&gt;
                          &lt;addContextWarDependencies&gt;true&lt;/addContextWarDependencies&gt;
                          &lt;addWarDependenciesInClassloader&gt;true&lt;/addWarDependenciesInClassloader&gt;
                          &lt;warSourceDirectory&gt;${project.build.directory}/${project.build.finalName}/&lt;/warSourceDirectory&gt;
                      &lt;/configuration&gt;
                      &lt;dependencies&gt;
                          &lt;dependency&gt;
                              &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
                              &lt;artifactId&gt;bar&lt;/artifactId&gt;
                              &lt;version&gt;${project.version}&lt;/version&gt;
                              &lt;type&gt;war&lt;/type&gt;
                              &lt;scope&gt;tomcat&lt;/scope&gt;
                          &lt;/dependency&gt;
                      &lt;/dependencies&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;apache.snapshots&lt;/id&gt;
              &lt;name&gt;Apache Snapshots&lt;/name&gt;
              &lt;url&gt;http://repository.apache.org/content/groups/snapshots-group/&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/releases&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/pluginRepository&gt;
       &lt;/pluginRepositories&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Is this possible with the <code>tomcat7-maven-plugin:run</code> plugin? I'm struggling to find the correct syntax to get it to play well. When I run the <code>maven</code> command to run it, it only runs the first one it finds in the project hierarchy. And if I run them with the <code>&lt;fork&gt;true&lt;/fork&gt;</code> or obviously from different terminals then I get "java.net.BindException: Address already in use :8080".</p>