title: How to Configure pom.xml to run 2 java mains in 1 Maven project
body: <p>I have a Maven project and it has 2 mains (MyTestApp_A, and MyTestApp_B) inside one of the packages from the src folder. </p>
  
  <p>I can run these "main" classes in Eclipse if I open them and click the run button. However, Eclipse is bugged, and so I actually need to run these two classes on a command line using Maven. </p>
  
  <p>I have never used Maven before, but after asking for help and doing some research I understand that I have to change the pom.xml file. </p>
  
  <p>Consequently, I have altered my pom.xml file successfully to  run one of the apps using the command <code>mvn exec:java -Dexec.mainClass="servers.MyTestApp_B"</code>:</p>
  
  <pre><code>    &lt;plugins&gt;
          &lt;!-- Allows the example to be run via 'mvn compile exec:java' --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
  
              &lt;configuration&gt;
                  &lt;mainClass&gt;servers.MyTestApp_A&lt;/mainClass&gt;
                  &lt;includePluginDependencies&gt;false&lt;/includePluginDependencies&gt;
              &lt;/configuration&gt;
  
  
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  </code></pre>
  
  <p>Happy with being able to run MyTestApp_A, I tried to add another configuration part to run MyTestApp_B:</p>
  
  <pre><code>    &lt;plugins&gt;
          &lt;!-- Allows the example to be run via 'mvn compile exec:java' --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
  
              &lt;configuration&gt;
                  &lt;mainClass&gt;servers.MyTestApp_A&lt;/mainClass&gt;
                  &lt;includePluginDependencies&gt;false&lt;/includePluginDependencies&gt;
              &lt;/configuration&gt;
              &lt;configuration&gt;
                  &lt;mainClass&gt;servers.MyTestApp_B&lt;/mainClass&gt;
                  &lt;includePluginDependencies&gt;false&lt;/includePluginDependencies&gt;
              &lt;/configuration&gt;
  
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  </code></pre>
  
  <p>However, This file is not well formed. Apparently I am not allowed to have 2 <code>&lt;configuration&gt;</code> tags in the same pom.xml file.</p>
  
  <p>So, how can I execute MyTestApp_A, and MyTestApp_B using Maven? How do I configure the pom.xml file?</p>